Raise error with custom header and value

15 views
Skip to first unread message

Travis Bell

unread,
Mar 6, 2014, 6:55:35 PM3/6/14
to golia...@googlegroups.com
Hey guys.


But the issue I am having is that I need to set the header value to a value that I call in the pre_process block.

It's for an API rate limiting proxy, very similar to the example by Ilya. We get the time remaining in the timebin and I'd like to set a 429 status with "Retry-After" header. I'm just having a hell of a time getting the time value returned and pushed into any kind of an error header. Does anyone have any helpful tips?

Thiago Lewin

unread,
Mar 7, 2014, 1:41:07 PM3/7/14
to golia...@googlegroups.com
Hi Travis,

  I don't have sure if I totally understood you. 
  I think you can follow the example that you mentioned, you just keep the header values into an env variable for the Request#post_request setup the header properly.
  
Regards,
Thiago

Travis Bell

unread,
Mar 7, 2014, 6:31:48 PM3/7/14
to golia...@googlegroups.com
Yup, that's exactly what I figured out about 30 minutes after I posted my message.

Thanks for the reply Thiago!

blackanger

unread,
Apr 25, 2014, 6:20:42 AM4/25/14
to golia...@googlegroups.com
     class CustomError < Goliath::Validation::Error
        def initialize
          code = "6000003"
          message = "custom error message."
          super(code, message)
        end
      end
Reply all
Reply to author
Forward
0 new messages