Skip to content

Instantly share code, notes, and snippets.

@markburns
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markburns/46989e0c76a71cd6d7f7 to your computer and use it in GitHub Desktop.
Save markburns/46989e0c76a71cd6d7f7 to your computer and use it in GitHub Desktop.
I wonder if there's any cross-browser libraries that do this kind of thing
error = {
message: "Expected true to be false.",
stack: "Error: Expected true to be false.\n at new jasmine.ExpectationResult (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:114:32)\n at null.toBe (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:1237:29)\n at null.<anonymous> (http://0.0.0.0:3001/relative/assets/integration/integration_spec.js?body=1:11:27)\n at jasmine.Block.execute (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:1066:17)\n at jasmine.Queue.next_ (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2098:31)\n at jasmine.Queue.start (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2051:8)\n at jasmine.Spec.execute (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2378:14)\n at jasmine.Queue.next_ (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2098:31)\n at jasmine.Queue.start (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2051:8)\n at jasmine.Suite.execute (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2523:14)\n\n"
}
wrapped = new ErrorWrapper(error)
wrapped.errorType
//=> "Error"
wrapped.message
//=> "Expected true to be false."
wrapped.stack[0]
//=>
{
method: "new jasmine.ExpectationResult",
url: {
toString: "http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1",
protocol: "http",
host: "0.0.0.0:3000",
path: "/relative/assets/jasmine/1.3.1.js",
query: {"body": "1"}
},
lineNumber: 114,
character: 32
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment