kallaballa / MidiPatch

MidiPatch is a scriptable and modular real-time software synthesizer using the PatchScript API
GNU Affero General Public License v3.0
12 stars 2 forks source link

Improve readability of lua errors in conjunction with bindings #102

Open kallaballa opened 4 years ago

kallaballa commented 4 years ago

For example, this error message means that there was an attempt at multiplying a number with a ControlMidiToFreq:

2019-11-23 18:58:24 [Error] Runtime error
maybe...Argument mismatch:number,Tonic::ControlMidiToFreq    candidate is:
        Tonic::ControlMidiToFreq,float,
        Tonic::ControlMidiToFreq,Tonic::ControlGenerator,

stack traceback:
    [C]: in metamethod '__mul'
    /home/elchaschab/.patchscript/data//midipatch.pat:28: in main chunk

We'd prefer to have a simpler error message like this:

2019-11-23 18:58:24 [Error] Runtime error
Attempt to illegally multiply "number" with "Tonic::ControlMidiToFreq".
Candidates:
        Tonic::ControlMidiToFreq,float,
        Tonic::ControlMidiToFreq,Tonic::ControlGenerator

stack traceback:
    [C]: in metamethod '__mul'
    /home/elchaschab/.patchscript/data//midipatch.pat:28: in main chunk
kallaballa commented 4 years ago

That error message is generated by kaguya and we probably have to patch it unless i missed something. I'm investigating