Open EverlastingBugstopper opened 2 years ago
I was gonna open an issue but it looks the same is this.
Test case: add crates/apollo-compiler/test_data/diagnostics/0050_unnamed_object_type.graphql
type {
cat: String
}
cargo test
:
thread 'tests::compiler_tests' panicked at 'Field must have a name', crates/apollo-compiler/src/database/hir_db.rs:1092:24
In general, any use of Option::expect
or similar should probably be replaced by something that emits a diagnostic and continues with some kind of fallback (such as skipping ill-formed definitions in the HIR)
Yes! I think I'll be working on this next as I'm already having to write more .expect()
s changing some of our From
impls to TryFrom
, and it feels bad (and it is bad for untrusted user input 😇 ).
I think our first step will be to outright skip things in the HIR. If the HIR can't be generated fully, it should be because there was a parser error, which is already reported.
ugh yea this is handled really rather terribly atm (i only say this because i am responsible >.<). would be so very good to fix this!!
there are a few overarching considerations when uniting the two types of errors here:
if you place characters after a
[Type]
, like[Type]oops
,apollo-compiler
will panic.example valid schema:
example panic schema:
abbreviated panic
panic with full backtrace