Made error message format consistent (#591)

Co-authored-by: Max Isom <codetheweb@users.noreply.github.com>
This commit is contained in:
Rithwik Rayani 2022-03-24 04:58:06 +05:30 committed by GitHub
parent 88d49de5a1
commit cf49053370
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -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}`;
}
}