Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aligns error reporting with the GNU standard #147

Merged
merged 3 commits into from
Nov 22, 2023

Conversation

bladyjoker
Copy link
Contributor

@bladyjoker bladyjoker commented Nov 16, 2023

Closes #144

Tried my best to align it but there's still awkwardness in the output. I don't know how GNU standard https://www.gnu.org/prep/standards/html_node/Errors.html accounts for message types (info/err/debug etc). I would like to have smtn like Syslog tbh, but whatever IDEs want I'm fine with that.

Maybe I should just split to stdout for INFO and stderr for ERROR, I always disliked having 2 separate files for this especially when I'm trying to pipe and then completely forget how to process the stderr.

Example

duplicate_tydef/A.lbf:5.1-5.12: [module A] Duplicate type definition with the name A [ERROR]                                                                                                                                                                                                                                                                                          
import_cycle_found/C.lbf:3.1-3.9: [module C] Tried to load module A which constitutes a cycle [B, A, ] [ERROR]                                                                                                                                                                                                                                                                        
imported_not_found/A.lbf:3.17-3.18: [module A] Name C not found in module B, did you mean one of the types: A B. Or did you mean one of the classes:  [ERROR]                                                                                                                                                                                                                         
invalid_module_filepath/A.lbf:1.8-1.13: [module A.B.C] File name invalid_module_filepath/A.lbf doesn't match module name A.B.C expected A/B/C.lbf [ERROR]                                                                                                                                                                                                                             
module_not_found/A.lbf:3.1-3.9: [module A] Module B not found in available import paths [., module_not_found] [ERROR]                                                                                                                                                                                                                                                                 
module_parse_error/A.lbf:3.1:                                                                                                                                                                                                                                                                                                                                                         
unexpected 't'                                                                                                                                                                                                                                                                                                                                                                        
expecting import statement, type definition, class definition, instance clause, derive statement or end of input [ERROR]                                                                                                                                                                                                                                                              
multiple_modules_found/A.lbf:3.1-3.9: [module A] Module B found in multiple files [multiple_modules_found/B.lbf, multiple_modules_found/another_import_path/B.lbf] [ERROR]                                                                                                                                                                                                            
symbol_already_imported/A.lbf:4.1-4.9: [module A] Type name A already imported from module B [ERROR]                                                                                                                                                                                                                                                                                  
tydef_name_conflict/A.lbf:5.5-5.6: [module A] Type name A conflicts with an imported type name from module B [ERROR]                                                                                                                                                                                                                                                                  
tyref_not_found/A.lbf:6.13-6.28: [module A] Type WhereIsThisType not found in the module's scope A B C B.B C.C [ERROR]                                                                                                                                                                                                                                                                
Calling: /nix/store/jmzq37c7l89qnvhyk1a3s98dl9b8lwki-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc compile --input-file /tmp/lbf-c229555e491ac5fc/compiler-input.textproto --output-file /tmp/lbf-c229555e491ac5fc/compiler-output.textproto [INFO]                                                                                                                                 
/nix/store/jmzq37c7l89qnvhyk1a3s98dl9b8lwki-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc: Reading Compiler Input from /tmp/lbf-c229555e491ac5fc/compiler-input.textproto [INFO] [INFO]                                                                                                                                                                                             
/nix/store/jmzq37c7l89qnvhyk1a3s98dl9b8lwki-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc: /tmp/lbf-c229555e491ac5fc/compiler-input.textproto: Compilation succeeded [INFO] [INFO]                                                                                                                                                                                                  
/nix/store/jmzq37c7l89qnvhyk1a3s98dl9b8lwki-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc: Writing Compiler Output at /tmp/lbf-c229555e491ac5fc/compiler-output.textproto [INFO] [INFO]                                                                                                                                                                                             
Success from: /nix/store/jmzq37c7l89qnvhyk1a3s98dl9b8lwki-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc compile --input-file /tmp/lbf-c229555e491ac5fc/compiler-input.textproto --output-file /tmp/lbf-c229555e491ac5fc/compiler-output.textproto [INFO]                                                                                                                            
Compilation OK [INFO]                                                                                                                                                                                                                                                                                                                                                                 
Calling: /nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell --input /tmp/lbf-c229555e491ac5fc/codegen-input.textproto --output /tmp/lbf-c229555e491ac5fc/codegen-output.textproto --gen-dir good/autogen --debug Test [INFO]                                                                                                                                     
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: Reading Codegen Input at /tmp/lbf-c229555e491ac5fc/codegen-input.textproto [INFO] [INFO]                                                                                                                                                                                                                     
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: Options received: GenOpts {_inputFile = "/tmp/lbf-c229555e491ac5fc/codegen-input.textproto", _outputFile = "/tmp/lbf-c229555e491ac5fc/codegen-output.textproto", _genDir = "good/autogen", _debug = True, _requestedClasses = [], _requestedModules = "Test" :| []} [INFO] [INFO]                            
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: Computed class closure:  [INFO] [INFO]                                                                                                                                                                                                                                                                       
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: /tmp/lbf-c229555e491ac5fc/codegen-input.textproto: Code generation failed for module Test [INFO] [INFO]                                                                                                                                                                                                      
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: /tmp/lbf-c229555e491ac5fc/codegen-input.textproto: Code generation failed [ERROR] [INFO]                                                                                                                                                                                                                     
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: Writing Codegen Output at /tmp/lbf-c229555e491ac5fc/codegen-output.textproto [INFO] [INFO]                                                                                                                                                                                                                   
Success from: /nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell --input /tmp/lbf-c229555e491ac5fc/codegen-input.textproto --output /tmp/lbf-c229555e491ac5fc/codegen-output.textproto --gen-dir good/autogen --debug Test [INFO]                                                                                                                                
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell:The requested Codegen backend doesn't support the LambdaBuffers `opaque` type 'Bytes' defined in module 'Test' [ERROR]                                                                                                                                                                                        

@bladyjoker bladyjoker self-assigned this Nov 16, 2023
@bladyjoker bladyjoker added the enhancement New feature or request label Nov 16, 2023
@t4ccer
Copy link
Member

t4ccer commented Nov 16, 2023

Looks fine, format parses correctly
Screenshot_20231116_123413

Copy link
Collaborator

@jaredponn jaredponn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Just some minor suggestions -- completely up to you in the end though!

@t4ccer
Copy link
Member

t4ccer commented Nov 17, 2023

Usually the split between stdout and stderr is such that to stdout goes stuff that you may want to pipe into another tool and all diagnostics into stderr. E.g. with curl all progress and debug stuff from -v goes to stderr but the file you're downloading goes to stdout. Not sure if there is a meaningful stdout for LB though

@bladyjoker
Copy link
Contributor Author

@t4ccer how do you use this output with Emacs? I assume you get something out of the box with some kind of mode?

@t4ccer
Copy link
Member

t4ccer commented Nov 17, 2023

Plain emacs
M-x compile <type your command>

@bladyjoker bladyjoker added the ux All things related to user experience label Nov 17, 2023
@bladyjoker bladyjoker added this pull request to the merge queue Nov 22, 2023
Merged via the queue into main with commit 05cdec8 Nov 22, 2023
2 checks passed
@bladyjoker bladyjoker deleted the bladyjoker/gnu-error-msg branch November 22, 2023 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend ux All things related to user experience
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Align error reporting with GNU standard
3 participants