Skip to content

Commit 58b0409

Browse files
authored
chore: bump ably-js to 1.2.45 (ably#200)
Updated ably-js to 1.2.45 Also replaced `ErrorInfo` implementation
1 parent 21528ac commit 58b0409

File tree

3 files changed

+26
-59
lines changed

3 files changed

+26
-59
lines changed

package-lock.json

Lines changed: 19 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@
5858
"nanoid": "^4.0.2"
5959
},
6060
"peerDependencies": {
61-
"ably": "^1.2.43"
61+
"ably": "^1.2.45"
6262
}
6363
}

src/Errors.ts

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,12 @@
1-
interface ErrorInfoValues {
2-
message: string;
3-
code: number;
4-
statusCode: number;
5-
}
1+
import { ErrorInfo } from 'ably';
62

7-
// TODO: export ErrorInfo from ably-js and use that instead.
8-
export class ErrorInfo extends Error {
9-
code: number;
10-
statusCode: number;
3+
export const ERR_SPACE_NAME_MISSING = () => new ErrorInfo('must have a non-empty name for the space', 101000, 400);
114

12-
constructor({ message, code, statusCode }: ErrorInfoValues) {
13-
super(message);
5+
export const ERR_NOT_ENTERED_SPACE = () => new ErrorInfo('must enter a space to perform this operation', 101001, 400);
146

15-
if (typeof Object.setPrototypeOf !== 'undefined') {
16-
Object.setPrototypeOf(this, ErrorInfo.prototype);
17-
}
7+
export const ERR_LOCK_REQUEST_EXISTS = () => new ErrorInfo('lock request already exists', 101002, 400);
188

19-
this.code = code;
20-
this.statusCode = statusCode;
21-
}
22-
}
23-
24-
export const ERR_SPACE_NAME_MISSING = () =>
25-
new ErrorInfo({
26-
message: 'must have a non-empty name for the space',
27-
code: 101000,
28-
statusCode: 400,
29-
});
30-
31-
export const ERR_NOT_ENTERED_SPACE = () =>
32-
new ErrorInfo({
33-
message: 'must enter a space to perform this operation',
34-
code: 101001,
35-
statusCode: 400,
36-
});
37-
38-
export const ERR_LOCK_REQUEST_EXISTS = () =>
39-
new ErrorInfo({
40-
message: 'lock request already exists',
41-
code: 101002,
42-
statusCode: 400,
43-
});
44-
45-
export const ERR_LOCK_IS_LOCKED = () =>
46-
new ErrorInfo({
47-
message: 'lock is currently locked',
48-
code: 101003,
49-
statusCode: 400,
50-
});
9+
export const ERR_LOCK_IS_LOCKED = () => new ErrorInfo('lock is currently locked', 101003, 400);
5110

5211
export const ERR_LOCK_INVALIDATED = () =>
53-
new ErrorInfo({
54-
message: 'lock was invalidated by a concurrent lock request which now holds the lock',
55-
code: 101004,
56-
statusCode: 400,
57-
});
12+
new ErrorInfo('lock was invalidated by a concurrent lock request which now holds the lock', 101004, 400);

0 commit comments

Comments
 (0)