-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Persist API: more logging and fix tracing error (#1590)
* add logging when request to persist API fails * dd-tracer setTag('error', value): value should be an error (not a string) * persist: batchSave/Delete/Update: throw error instead of returning false batch operations results is rarely checked by integration. Throwing an error instead of returning false in order to not fail silently
- Loading branch information
Showing
3 changed files
with
66 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
export type Result<T, E = Error> = { ok: true; value: T } | { ok: false; error: E }; | ||
export function ok<T>(value: T): Result<T> { | ||
export type ResultValue<T> = { ok: true; value: T }; | ||
export type ResultError<E extends Error> = { ok: false; error: E }; | ||
export function ok<T>(value: T): ResultValue<T> { | ||
return { ok: true, value }; | ||
} | ||
export function err<E extends Error>(errMsg: string): Result<never, E> { | ||
export function err<E extends Error>(errMsg: string): ResultError<E> { | ||
const e = new Error(errMsg) as E; | ||
return { ok: false, error: e }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters