SemGuS-git / Semgus-Parser

Library and tool for parsing SemGuS specifications
MIT License
4 stars 1 forks source link

Error in `constraint` command throws exception instead of printing useful message #43

Closed kjcjohnson closed 2 years ago

kjcjohnson commented 2 years ago

The constraint command evidently just dumps a nasty stack trace when the term is in an error state. This should be cleaned up to not be terrible.

Stack trace:

Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: Term in constraint is in error state: Semgus.Parser.Reader.ErrorTerm
   at Semgus.Parser.Commands.ConstraintCommand.Constraint(SmtTerm predicate) in D:\dev\semgus\temp\Semgus-Parser\ParserLibrary\Commands\ConstraintCommand.cs:line 40
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Semgus.Parser.Reader.DestructuringHelper.TryDestructureAndInvoke(MethodInfo method, IConsOrNil form, Object instance) in D:\dev\semgus\temp\Semgus-Parser\ParserLibrary\Reader\DestructuringHelper.cs:line 36
   at Semgus.Parser.SemgusParser.TryParse(ISemgusProblemHandler handler, Int32& errCount, TextWriter errorStream) in D:\dev\semgus\temp\Semgus-Parser\ParserLibrary\SemgusParser.cs:line 181
   at Semgus.Parser.Program.Execute(ProcessingMode mode, OutputFormat format, Boolean test, String output, IEnumerable`1 inputs) in D:\dev\semgus\temp\Semgus-Parser\SemgusParser\Program.cs:line 114
   at Semgus.Parser.Program.<>c.<Main>b__2_4(ProcessingMode mode, OutputFormat format, Boolean test, String output, String[] inputs, InvocationContext ctx) in D:\dev\semgus\temp\Semgus-Parser\SemgusParser\Program.cs:line 87
   at System.CommandLine.Handler.<>c__DisplayClass6_0`6.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.<>c__DisplayClass2_0.<.ctor>g__Handle|0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass20_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass9_0.<<UseExceptionHandler>b__0>d.MoveNext()