Skip to content

Commit b3b0101

Browse files
committed
Merge branch 'master' of https://github.com/steaks/exceptions.js
2 parents 24c9ac7 + 2633036 commit b3b0101

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Basic setup and usage
1111

1212
//Setup the exceptions handler to report errors when
1313
//you call Exception.report() or window.onerror executes
14-
exeptions.handler
14+
exceptions.handler
1515
.stacktraceUrl("http://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/0.6.0/stacktrace.js")
1616
.html2canvasUrl("http://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js")
1717
.postUrl("http://localhost/handleException")

exceptions.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@
1515
exceptions,
1616
utilities,
1717
_scopeOption;
18+
19+
//polyfill for Object.create so we can support inheritance in ie8
20+
if (typeof Object.create != 'function') {
21+
(function () {
22+
var F = function () { };
23+
Object.create = function (o) {
24+
if (arguments.length > 1) {
25+
throw Error('Second argument not supported');
26+
}
27+
if (o === null) {
28+
throw Error('Cannot set a null [[Prototype]]');
29+
}
30+
if (typeof o != 'object') {
31+
throw TypeError('Argument must be an object');
32+
}
33+
F.prototype = o;
34+
return new F();
35+
};
36+
})();
37+
}
1838

1939
utilities = {
2040
/**
@@ -192,7 +212,7 @@
192212
* @return Custom exception. The type will be the function you provided in the config.exception property.
193213
*/
194214
function createCustomException(config) {
195-
if (ArgumentException) {
215+
if (ArgumentException && ArgumentException.throwIf) {
196216
ArgumentException.throwIf(!utilities.functionName(config.exception), "Your exception constructor must have a name. See examples on github.")
197217
}
198218
createCustomException._mixStaticFunctions(config.exception);
@@ -735,7 +755,7 @@
735755
if (!exception.error().stack && !exceptions.handler.stacktraceUrl()){
736756
o.stacktrace(false);
737757
}
738-
if (!exceptions.handler.html2canvasUrl()){
758+
if (!exceptions.handler.html2canvasUrl() || !window.getComputedStyle){
739759
o.screenshot(false);
740760
}
741761
if (!exceptions.handler.postUrl()){
@@ -1158,7 +1178,7 @@
11581178
TypeException: TypeException,
11591179
URIException: URIException,
11601180
createCustomException: createCustomException,
1161-
handler: handler,
1181+
handler: handler
11621182
};
11631183

11641184
window.exceptions = exceptions;

0 commit comments

Comments
 (0)