UNPKG

@typespec/ts-http-runtime

Version:

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

19 lines 612 B
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", { value: true }); exports.isError = isError; const object_js_1 = require("./object.js"); /** * Typeguard for an error object shape (has name and message) * @param e - Something caught by a catch clause. */ function isError(e) { if ((0, object_js_1.isObject)(e)) { const hasName = typeof e.name === "string"; const hasMessage = typeof e.message === "string"; return hasName && hasMessage; } return false; } //# sourceMappingURL=error.js.map