UNPKG

@typespec/ts-http-runtime

Version:

Isomorphic client library for making HTTP requests in node.js and browser.

16 lines 494 B
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { isObject } from "./object.js"; /** * Typeguard for an error object shape (has name and message) * @param e - Something caught by a catch clause. */ export function isError(e) { if (isObject(e)) { const hasName = typeof e.name === "string"; const hasMessage = typeof e.message === "string"; return hasName && hasMessage; } return false; } //# sourceMappingURL=error.js.map