mdec: return meaningful error codes.