Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

isError.js 869B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.default = isError;
  6. var _prettyFormat = require('pretty-format');
  7. /**
  8. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  9. *
  10. * This source code is licensed under the MIT license found in the
  11. * LICENSE file in the root directory of this source tree.
  12. */
  13. function isError(potentialError) { // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
  14. // duck-type Error, see #2549
  15. const isError =
  16. potentialError !== null &&
  17. typeof potentialError === 'object' &&
  18. typeof potentialError.message === 'string' &&
  19. typeof potentialError.name === 'string';
  20. const message = isError
  21. ? null
  22. : `Failed: ${(0, _prettyFormat.format)(potentialError, {
  23. maxDepth: 3
  24. })}`;
  25. return {
  26. isError,
  27. message
  28. };
  29. }