Skip to content

Commit d9463cc

Browse files
committed
fix: fix constructor
1 parent d80da5e commit d9463cc

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

lib/_browser/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,21 @@ class Result {
3030
// object
3131
else if ( typeof status === "object" ) {
3232

33+
// Result
34+
if ( status instanceof Result ) {
35+
status = status.status;
36+
statusText = status.statusText;
37+
}
38+
3339
// Error
34-
if ( status instanceof Error ) {
40+
else if ( status instanceof Error ) {
3541
status = 500;
3642
statusText = status.message;
3743
}
3844

39-
// other object
45+
// invalid status
4046
else {
41-
status = status.status;
42-
statusText = status.statusText;
47+
throw new TypeError( "Result status is not valid" );
4348
}
4449
}
4550
}

0 commit comments

Comments
 (0)