mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-26 22:29:24 +00:00
explicit error typing
This commit is contained in:
parent
af6ef53aed
commit
463daf2ed0
@ -36,7 +36,13 @@ const extractFromJsonData = (data: unknown): string | null => {
|
|||||||
/**
|
/**
|
||||||
* Default error extractor that follows the standard pattern
|
* Default error extractor that follows the standard pattern
|
||||||
*/
|
*/
|
||||||
export const extractErrorMessage = (error: ToolError): string => {
|
export const extractErrorMessage = (error: unknown): string => {
|
||||||
|
// Early return if error is null/undefined
|
||||||
|
if (!error || (typeof error !== 'object')) {
|
||||||
|
return 'Operation failed';
|
||||||
|
}
|
||||||
|
|
||||||
|
const typedError = error as ToolError;
|
||||||
|
|
||||||
// Try response.data first
|
// Try response.data first
|
||||||
if (typedError.response?.data) {
|
if (typedError.response?.data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user