Skip to content

Instantly share code, notes, and snippets.

@Boldewyn
Created May 28, 2011 18:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Boldewyn/997109 to your computer and use it in GitHub Desktop.
Save Boldewyn/997109 to your computer and use it in GitHub Desktop.
HTTP Error Responses by MIME Type
This is a collection of templates, that depict HTTP error messages in different MIME types.
Each template expects the parameters
* {CODE} - the numeric HTTP error code
* {PHRASE} - the reason phrase, e.g., "Not Found" for 404
and in some cases the parameter
* {URL} - the requested URL where the error occurred. This value MUST be quoted adeptly for each template.
/* {CODE} {PHRASE} */
body {}
if (this.console && this.console.error) {
console.error('{CODE} {PHRASE}\nLocation: {URL}');
}
{
"error": true,
"errno": {CODE},
"errmsg": "{PHRASE}",
"errlocation": "{URL}"
}
<?xml version="1.0" encoding="UTF-8" ?>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<merror>{CODE} {PHRASE}</merror>
</math>
iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQMAAABKLAcXAAAAA1BMVEX/AAAZ4gk3AAAAE0lEQVQYGWMYBaNgFIyCUUBXAAAFeAAB3EUCGwAAAABJRU5ErkJggg==
<?xml version="1.0" encoding="UTF-8" ?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:http="http://www.w3.org/2006/http#">
<http:Response rdf:ID="response">
<http:httpVersion>1.1</http:httpVersion>
<http:statusCodeNumber>{CODE}</http:statusCodeNumber>
<http:sc rdf:resource="http://www.w3.org/2008/http-statusCodes#statusCode{CODE}" />
<http:reasonPhrase>{PHRASE}</http:reasonPhrase>
<http:headers rdf:parseType="Collection">
<http:MessageHeader>
<http:fieldName>Location</http:fieldName>
<http:hdrName rdf:resource="http://www.w3.org/2008/http-headers#Location"/>
<http:fieldValue>{URL}</http:fieldValue>
</http:MessageHeader>
</http:headers>
</http:Response>
</RDF>
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8" ?>
<svg version="1.0" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="100%" height="100%" fill="#F00" />
<text x="30" y="30" font-size="20" font-weight="bold" fill="white">{CODE} {PHRASE}</text>
<text x="30" y="60" font-size="16" font-weight="bold" fill="white">
The error occurred while requesting <tspan style="font-family: monospace">{URL}</tspan>.
</text>
</svg>
<?xml version="1.0" encoding="UTF-8" ?>
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
<template match="/">
<message terminate="yes">{CODE} {PHRASE}</message>
</template>
</stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment