Consolidate error handling code
The *_ERROR constants are available in Keruald OmniTools 0.15.1,
as part of 6f31873efc42.
The dprint_r and dieprint_r methods have been added in 0.2.0,
as part of c7e86b370905.
Differential Revision: https://devcentral.nasqueron.org/D3794