droplet_kit icon indicating copy to clipboard operation
droplet_kit copied to clipboard

error handling

Open mm580486 opened this issue 7 years ago • 0 comments

hi i want return DO errors as json for sample i create one droplet like this <DropletKit::Droplet {:@name=>"zoodfish", :@region=>"blah blah", :@size=>"512mb", :@image=>14782899, :@ipv6=>true, :@tags=>["namechip"], :@id=>nil, :@memory=>nil, :@vcpus=>nil, :@disk=>nil, :@locked=>nil, :@created_at=>nil, :@status=>nil, :@backup_ids=>nil, :@snapshot_ids=>nil, :@action_ids=>nil, :@features=>nil, :@networks=>nil, :@kernel=>nil, :@size_slug=>nil, :@names=>nil, :@volumes=>nil, :@ssh_keys=>nil, :@backups=>nil, :@monitoring=>nil, :@user_data=>nil, :@private_networking=>nil}>

and DropletKit gem return this


DropletKit::FailedCreate: You specified an invalid region for Droplet creation.
	from (irb):138

but i want make error response like this

{status: 400,message: 'something worng OR else'}

for sample status 400 point to invalid region

how can i make this response ?

mm580486 avatar Feb 17 '18 12:02 mm580486