MCPcopy
hub / github.com/jvilk/BrowserFS / onErrorHandler

Function onErrorHandler

src/backend/IndexedDB.ts:38–44  ·  view source on GitHub ↗

* Produces a new onerror handler for IDB. Our errors are always fatal, so we * handle them generically: Call the user-supplied callback with a translated * version of the error, and let the error bubble up. * @hidden

(cb: (e: ApiError) => void, code: ErrorCode = ErrorCode.EIO, message: string | null = null)

Source from the content-addressed store, hash-verified

36 * @hidden
37 */
38function onErrorHandler(cb: (e: ApiError) => void, code: ErrorCode = ErrorCode.EIO, message: string | null = null): (e?: any) => void {
39 return function(e?: any): void {
40 // Prevent the error from canceling the transaction.
41 e.preventDefault();
42 cb(new ApiError(code, message !== null ? message : undefined));
43 };
44}
45
46/**
47 * @hidden

Callers 5

getMethod · 0.85
putMethod · 0.85
delMethod · 0.85
constructorMethod · 0.85
clearMethod · 0.85

Calls 1

cbFunction · 0.85

Tested by

no test coverage detected