fix(schema_cache): return results #154
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We were calling
.unwrap()
on all database queries that loaded the schemas for theSchemaCache
. I changed them so they (and the parentSchemaCache.load(..)
) returnResult
s.Also:
SchemaCache.load()
is calledSchemaCacheError
that implements theDiagnostic
trait and implementedFrom<SchemaCacheError> for WorkspaceError
get_new_test_db()
frompg_test_utils
in some tests – they were failing for me because of a missing env var, hope this didn't break anything?Please check:
I'm not sure yet how the whole
Diagnostic
thing works. Does it need to be implemented for the SchemaCache?I also wondered if we even want a specific
SchemaCacheError
type – we could also return asqlx::Error
, since there are only database connections and there's no other fallible business logic?Lastly, the
test_check_sql
test inpg_typecheck/src/lib.rs
suddenly failed because we're now getting a "contact" instead of an "unknown" string – is this the correct output? :)Thank yooouuu