refactor error code to gsapi-errors.ads/b