ensure that errors when serialized have message and type properties