skif_js_syntax/error.rs
1//! Errors returned by this crate.
2
3use skif_core::Span;
4
5/// Why a file could not be turned into a [`crate::ModuleInfo`].
6#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
7pub enum SyntaxError {
8 /// The parser reported a syntax error.
9 #[error("{message} at {}:{}", .span.start_line, .span.start_col)]
10 Parse {
11 /// First error message.
12 message: String,
13 /// Location of the first error.
14 span: Span,
15 },
16 /// The file extension is not a supported script or component type.
17 #[error("unsupported file type: {extension}")]
18 Unsupported {
19 /// The extension (without dot), empty if none.
20 extension: String,
21 },
22}