forked from microsoft/FluidFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathodspError.ts
More file actions
21 lines (19 loc) · 820 Bytes
/
odspError.ts
File metadata and controls
21 lines (19 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*!
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { createOdspNetworkError, OdspError } from "@fluidframework/odsp-doclib-utils";
import { IOdspSocketError } from "./contracts";
/**
* Returns network error based on error object from ODSP socket (IOdspSocketError)
*/
export function errorObjectFromSocketError(socketError: IOdspSocketError, handler: string): OdspError {
const message = `socket.io: ${handler}: ${socketError.message}`;
return createOdspNetworkError(
message,
socketError.code,
socketError.retryAfter,
// TODO: When long lived token is supported for websocket then IOdspSocketError need to support
// passing "claims" value that is used to fetch new token
undefined /* claims */);
}