Skip to content

Instantly share code, notes, and snippets.

@Boldewyn
Created May 28, 2011
Embed
What would you like to do?
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>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?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