Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG Deskulpt can't handle syntax error in widget js code #9

Closed
Xinyu-Li-123 opened this issue Apr 6, 2024 · 1 comment · Fixed by #11
Closed

BUG Deskulpt can't handle syntax error in widget js code #9

Xinyu-Li-123 opened this issue Apr 6, 2024 · 1 comment · Fixed by #11
Labels
bug Something isn't working

Comments

@Xinyu-Li-123
Copy link
Contributor

Xinyu-Li-123 commented Apr 6, 2024

When there is a syntax error in the widget js code, Deskulpt will crash. This happens at commit 442cf1, the head commit when I submit this issue. Below is a minimal example to reproduce this bug.

const React = window.__DESKULPT__.defaultDeps.React;

// Syntax error here, misspell "const" as "conts", will crash Deskulpt
conts bannerText = "My Simple Banner";

function Banner() {
  return (
    <div>
      <h1>{bannerText}</h1>
    </div>
  );
}

export default {
  render: () => <Banner />,
};

And is the error message produced when Deskulpt crashes. It happens when I add this widget to the widgets folder and render. I run Deskulpt with npm run tauri dev.

error: Expected ';', '}' or <eof>
 --> \\?\C:\Users\eiger\AppData\Roaming\com.tauri.deskulpt\widgets\ok-simple-banner\src\App.jsx:3:7
  |
3 | conts bannerText = "My Simple Banner";
  | ----- ^^^^^^^^^^
  | |
  | This is the expression part of an expression statement   

thread 'main' panicked at src\bundler.rs:171:21:
FATAL: Failed to parse module
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[0406/173441.713:ERROR:window_impl.cc(121)] Failed to unregister class Chrome_WidgetWin_0. Error = 0

@Charlie-XIAO @ROMEEZHOU You might want to check this out since we are writing tests for bundler this week

@Xinyu-Li-123 Xinyu-Li-123 added the bug Something isn't working label Apr 6, 2024
@Charlie-XIAO
Copy link
Contributor

The error is currently emitted into the console, seems I forgot to change that. I need to figure out how to emit as a string though.

@Xinyu-Li-123 Xinyu-Li-123 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants