terminusdb / terminusdb

TerminusDB is a distributed database with a collaboration model
https://terminusdb.com
Apache License 2.0
2.79k stars 108 forks source link

Stack trace when schema check failure results from changing status of schema from CLI #1506

Open GavinMendelGleason opened 2 years ago

GavinMendelGleason commented 2 years ago
gavin@titan:~/dev/terminusdb-tutorials/star-wars$ terminusdb db update admin/starwars --schema=false
Database updated: admin/starwars
gavin@titan:~/dev/terminusdb-tutorials/star-wars$ terminusdb db update admin/starwars --schema=true
  [19] throw(error(schema_check_failure(...),_6916))
  [18] database:run_transactions('<garbage_collected>',false,_6960) at /home/gavin/dev/terminusdb/src/core/transaction/database.pl:275
  [17] database:with_transaction_(query_context{all_witnesses:false,authorization:'terminusdb://system/data/User/admin',bindings:[],commit_info:commit_info{author:'CLI: db update',message:'DB Update'},default_collection:branch_descriptor{branch_name:"main",repository_descriptor: ...},files:[],filter:type_filter{types: ...},prefixes:_7072{'@base':"terminusdb:///star-wars/",'@schema':"terminusdb:///schema/star-wars#",'@type':'Context',api:'http://terminusdb.com/schema/api#',json:'http://terminusdb.com/schema/json#',owl:'http://www.w3.org/2002/07/owl#',rdf:'http://www.w3.org/1999/02/22-rdf-syntax-ns#',rdfs:'http://www.w3.org/2000/01/rdf-schema#',sys:'http://terminusdb.com/schema/sys#',vio:'http://terminusdb.com/schema/vio#',woql:'http://terminusdb.com/schema/woql#',xdd:'http://terminusdb.com/schema/xdd#',xsd:'http://www.w3.org/2001/XMLSchema#'},selected:[],system:system_descriptor{},transaction_objects:[...],update_guard:_7050,write_graph:branch_graph{branch_name:"main",database_name:"starwars",organization_name:"admin",repository_name:"local",type:instance}},api_db_update:(...,...),_7000) at /home/gavin/dev/terminusdb/src/core/transaction/database.pl:240
  [16] setup_call_catcher_cleanup(database:pre_transaction_tabling,database:with_transaction_(...,...,_7246),_7224,database:post_transaction_tabling) at /home/gavin/.swivm/versions/v8.4.2/lib/swipl/boot/init.pl:663
  [12] catch(cli:api_db_update(...,"admin","starwars",'terminusdb://system/data/User/admin',...,...),error(schema_check_failure(...),context(_7320,_7322)),cli:do_or_die(...,...)) at /home/gavin/.swivm/versions/v8.4.2/lib/swipl/boot/init.pl:562
  [11] catch_with_backtrace('<garbage_collected>','<garbage_collected>','<garbage_collected>') at /home/gavin/.swivm/versions/v8.4.2/lib/swipl/boot/init.pl:629

Note: some frames are missing due to last-call optimization.
Re-run your program in debug mode (:- debug.) to get more detail.
Error: schema_check_failure([witness{'@type':instance_not_cardinality_one,class:'http://www.w3.org/2001/XMLSchema#string',instance:'terminusdb:///star-wars/film-1',predicate:'terminusdb:///schema/star-wars#label'}])
matko commented 2 years ago

stack trace is triggered if enabling schema checking leads to a schema check failure. This should be changed to return a proper error.