Skip to content

Commit

Permalink
Made error message format consistent (museofficial#591)
Browse files Browse the repository at this point in the history
Co-authored-by: Max Isom <codetheweb@users.noreply.github.com>
  • Loading branch information
therithwikrayani and codetheweb authored Mar 23, 2022
1 parent 88d49de commit cf49053
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Error messages consistently show as `🚫 ope: error`

## [1.7.0] - 2022-03-19
### Added
Expand Down
6 changes: 3 additions & 3 deletions src/utils/error-msg.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export default (error?: string | Error): string => {
let str = '🚫 unknown error';
let str = 'unknown error';

if (error) {
if (typeof error === 'string') {
str = `🚫 ${error}`;
str = `🚫ope: ${error}`;
} else if (error instanceof Error) {
str = `🚫 ope: ${error.message}`;
str = `🚫ope: ${error.message}`;
}
}

Expand Down

0 comments on commit cf49053

Please sign in to comment.