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

Minor: examples/server_fns_axum FileWatcher logs errors to the console. #2547

Merged
merged 2 commits into from
May 6, 2024

Conversation

martinfrances107
Copy link
Contributor

The cause is an assumption that the directory

./watched_files/

exits.

Thankfully the fix is simple

git has a standard convention - for preserving an empty directory.
Insert a zero sized file named EMPTY.

Here is the error -- logged to the browsers console.

[HOT RELOADING] Connected to server.
:3000/api/watched_files13867909705750298573:1 
        
        
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
server_fns_axum.js:503 panicked at src/app.rs:598:39:
called `Result::unwrap()` on an `Err` value: ServerError("No such file or directory (os error 2)")

Stack:

Error
    at imports.wbg.__wbg_new_abda76e883ba8a5f (http://127.0.0.1:3000/pkg/server_fns_axum.js:506:13)
    at console_error_panic_hook::Error::new::hca6973c430994da6 (http://127.0.0.1:3000/pkg/server_fns_axum.wasm:wasm-function[14183]:0x7c21d5)
    at console_error_panic_hook::hook_impl::hb822a00a5f8799dc (http://127.0.0.1:3000/pkg/server_fns_axum.wasm:wasm-function[3949]:0x5ebf84)
    at console_error_panic_hook::hook::h2fb62dcdff77287b (http://127.0.0.1:3000/pkg/server_fns_axum.wasm:wasm-function[16805]:0x7eb1aa)
    at core::ops::function::Fn::call::ha0f32b73068dce3a (http://127.0.0.1:3000/pkg/server_fns_axum.wasm:wasm-function[15300]:0x7d560b)
    at std::panicking::rust_panic_with_hook::h9aabd906218897c3 (http://127.0.0.1:3000/pkg/server_fns_axum.wasm:wasm-function[7470]:0x6ee2ab)
    at std::panicking::begin_panic_handler::{{closure}}::h96d2bc381fa6ee1e (http://127.0.0.1:3000/pkg/server_fns_axum.wasm:wasm-function[9088]:0x73a22f)
    at std::sys_common::backtrace::__rust_end_short_backtrace::ha76513a70bb070b0 (http://127.0.0.1:3000/pkg/server_fns_axum.wasm:wasm-function[19698]:0x8073cc)
    at rust_begin_unwind (http://127.0.0.1:3000/pkg/server_fns_axum.wasm:wasm-function[15919]:0x7df06b)
    at core::panicking::panic_fmt::h3aff855fe938c13f (http://127.0.0.1:3000/pkg/server_fns_axum.wasm:wasm-function[16578]:0x7e82f1)


imports.wbg.__wbg_error_f851667af71bcfc6 @ server_fns_axum.js:503
server_fns_axum.wasm:0x807675 Uncaught RuntimeError: unreachable
    at __rust_start_panic (server_fns_axum.wasm:0x807675)
    at rust_panic (server_fns_axum.wasm:0x806e01)
    at std::panicking::rust_panic_with_hook::h9aabd906218897c3 (server_fns_axum.wasm:0x6ee2d8)
    at std::panicking::begin_panic_handler::{{closure}}::h96d2bc381fa6ee1e (server_fns_axum.wasm:0x73a22f)
    at std::sys_common::backtrace::__rust_end_short_backtrace::ha76513a70bb070b0 (server_fns_axum.wasm:0x8073cc)
    at rust_begin_unwind (server_fns_axum.wasm:0x7df06b)
    at core::panicking::panic_fmt::h3aff855fe938c13f (server_fns_axum.wasm:0x7e82f1)
    at core::result::unwrap_failed::had70491c62ee681b (server_fns_axum.wasm:0x762916)
    at server_fns_axum::app::__FileWatcher::{{closure}}::{{closure}}::h6e2dc10b43754c36 (server_fns_axum.wasm:0xe23c9)
    at wasm_bindgen_futures::task::singlethread::Task::run::h9ad08afc33b86ae6 (server_fns_axum.wasm:0x579590)

The cause is an assumption that the directory

./watched_files/

exits.
@mondeja
Copy link
Contributor

mondeja commented Apr 24, 2024

git has a standard convention - for preserving an empty directory.
Insert a zero sized file named EMPTY.

I had never heard of that convention. The practice that I have encountered the most is to create a file named .gitkeep or simply .keep.

@martinfrances107
Copy link
Contributor Author

.gitkeep is very explict -- I will alter the PR and follow that convention... one sec

@gbj
Copy link
Collaborator

gbj commented May 6, 2024

Thanks!

@gbj gbj merged commit 289c02f into leptos-rs:main May 6, 2024
10 checks passed
@martinfrances107 martinfrances107 deleted the FileWatcher branch May 6, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants