-
|
I am trying to avoid showing red error messages by creating conditional views that only show when a file is loaded. However despite my attempts, I am still seeing them: Is there a way to turn these off? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
I don't know of any way to disable the error display, but you could handle the error instead. For example, you could use a try catch: ```js
const myValue = (() => {
try {
return file.csv();
} catch (error) {
console.warn("error with file", error);
return null;
}
})();
```or maybe just use a nullish coalescing operator: ```js
const myValue = file?.csv();
``` |
Beta Was this translation helpful? Give feedback.
-
|
Thank you, @mythmon . The error handling could work to return a blank/template data object, which would satisfy my downstream functions enough that they also wouldn't error out. If there were a simple means of switching error reporting from the display to instead only the console, it would be a lot easier. |
Beta Was this translation helpful? Give feedback.
-
|
If you set the required option on the Inputs.file, it will make the default value |
Beta Was this translation helpful? Give feedback.
-
|
Perfect! Thank you, @mbostock ! |
Beta Was this translation helpful? Give feedback.

If you set the required option on the Inputs.file, it will make the default value
undefinedrather thannull, which will cause downstream cells to wait rather than exposingfileas null.