Skip to content

Commit

Permalink
fix: ErrorInfo extends Error
Browse files Browse the repository at this point in the history
  • Loading branch information
owenpearson committed Feb 17, 2023
1 parent 10ed089 commit 0129846
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/common/lib/client/realtimechannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@ class RealtimeChannel extends Channel {
}

static invalidStateError(state: string): ErrorInfo {
return {
statusCode: 400,
code: 90001,
message: 'Channel operation failed as channel state is ' + state,
};
return new ErrorInfo('Channel operation failed as channel state is ' + state, 90001, 400);
}

static processListenerArgs(args: unknown[]): any[] {
Expand Down
3 changes: 2 additions & 1 deletion src/common/lib/types/errorinfo.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import Platform from 'common/platform';
import * as Utils from '../util/utils';

export default class ErrorInfo {
export default class ErrorInfo extends Error {
message: string;
code: number | null;
statusCode?: number;
cause?: string | Error | ErrorInfo;
href?: string;

constructor(message: string, code: number | null, statusCode?: number, cause?: string | Error | ErrorInfo) {
super(message);
this.message = message;
this.code = code;
this.statusCode = statusCode;
Expand Down

0 comments on commit 0129846

Please sign in to comment.