Skip to content

Commit

Permalink
Fail early if there is no "all" schema in DB
Browse files Browse the repository at this point in the history
Summary: Similar to D56531547. This diff avoids storing errors in fields and just fails early instead.

Reviewed By: simonmar

Differential Revision: D56579299

fbshipit-source-id: 19702d43ccac47a5ed3c537e7dbc19c152f8bf34
  • Loading branch information
Josef Svenningsson authored and facebook-github-bot committed Apr 26, 2024
1 parent c4b0fe7 commit d995c71
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions glean/db/Glean/Database/Schema.hs
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,12 @@ mkDbSchema toList cacheVar knownPids dbContent
Nothing -> throwIO $ ErrorCall "no \"all\" schema"
Just (_, id) -> return id

let
dbSchemaId =
dbSchemaId <-
case IntMap.lookupMax (hashedSchemaAllVersions stored) of
Nothing -> error "no \"all\" schema in DB"
Just (_, id) -> id
Nothing -> throwIO $ ErrorCall "no \"all\" schema in DB"
Just (_, id) -> return id

let
predicatesById = tcEnvPredicates tcEnv
derivationDepends = HashMap.fromListWith (++)
[ (p, pp) | (_, p, pp) <- derivationEdges predicatesById]
Expand Down

0 comments on commit d995c71

Please sign in to comment.