Use a compile time table to map errors

Closes #18