-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added image upload to eBay Kleinanzeigen.
- Loading branch information
Robert Honz
committed
Oct 28, 2021
1 parent
1dc8dfb
commit c37a0a6
Showing
4 changed files
with
1,008 additions
and
466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
import { RemoteSystemError, AuthorizationError, RemoteNotFound, AttributeError, AxiosError } from './exceptions'; | ||
|
||
import { readFile } from 'fs'; | ||
|
||
export const generateExceptionStr = (exc) => { | ||
return `${exc.name}: ${exc.message}` | ||
} | ||
|
||
export const exceptionHandler = (exc, ipcEvent) => { | ||
if (exc.constructor == AuthorizationError) { | ||
if (exc.constructor === AuthorizationError) { | ||
ipcEvent.reply('m-error-login', generateExceptionStr(exc)); | ||
} else if (exc.constructor == RemoteSystemError) { | ||
} else if (exc.constructor === RemoteSystemError) { | ||
ipcEvent.reply('m-error-general', generateExceptionStr(exc)); | ||
} else if (exc.constructor == RemoteNotFound) { | ||
} else if (exc.constructor === RemoteNotFound) { | ||
ipcEvent.reply('m-error-general', generateExceptionStr(exc)); | ||
} else if (exc.constructor == AttributeError) { | ||
} else if (exc.constructor === AttributeError) { | ||
ipcEvent.reply('m-error-general', generateExceptionStr(exc)); | ||
} else if (exc.constructor == AxiosError) { | ||
} else if (exc.constructor === AxiosError) { | ||
ipcEvent.reply('m-error-axios', exc); | ||
} else { | ||
ipcEvent.reply('m-error-general', exc.message); | ||
} | ||
} | ||
|
||
export const readFileAsync = async function (path) { | ||
return new Promise((resolve, reject) => { | ||
readFile(path, (err, data) => { | ||
if (err) { | ||
return reject(err); | ||
} | ||
|
||
return resolve(data); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.