krisppurg / dimscord

A Discord Bot & REST Library for Nim.
https://krisppurg.github.io/dimscord/
MIT License
222 stars 22 forks source link

Cleanup `event` pragma #122

Closed ire4ever1190 closed 4 months ago

ire4ever1190 commented 9 months ago

Error message

Updates the error message when the event is wrong. It now errors on the proc name instead of giving an undeclared field error Before

/tmp/test.nim(9, 35) template/generic instantiation of `event` from here
/home/user/.nimble/pkgs2/dimscord/dimscord/helpers.nim(37, 5) Error: undeclared field: 'test=' for type objects.Events [type declared in /home/user/.nimble/pkgs2/dimscord/dimscord/objects/typedefs.nim(849, 5)]

After

/home/user/Documents/projects/dimscord/dimscord/helpers.nim(74, 57) event
/home/user/Documents/projects/dimscord/test.nim(9, 6) Error: 'test' is not a valid dimscord event

Line info

Also makes sure the anonymous function has the same line info as the function, helps make some warnings/errors point to the right line