mishig HF staff commited on
Commit
bf9fb3d
1 Parent(s): ed1ed33

Imrpove error handling

Browse files
src/lib/components/InferencePlayground/InferencePlayground.svelte CHANGED
@@ -114,9 +114,15 @@
114
  if (streamingMsgAdded) {
115
  conversation.messages = conversation.messages.slice(0, -1);
116
  }
117
- hfToken = "";
118
- if (error.name !== "AbortError") {
119
- alert("error: " + (error as Error).message);
 
 
 
 
 
 
120
  }
121
  } finally {
122
  loading = false;
 
114
  if (streamingMsgAdded) {
115
  conversation.messages = conversation.messages.slice(0, -1);
116
  }
117
+ if (error instanceof Error) {
118
+ if (error.message.includes("token seems invalid")) {
119
+ hfToken = "";
120
+ }
121
+ if (error.name !== "AbortError") {
122
+ alert("error: " + error.message);
123
+ }
124
+ } else {
125
+ alert("An unknown error occurred");
126
  }
127
  } finally {
128
  loading = false;