buzzn / core

Die Kraft der Gemeinschaft
GNU Affero General Public License v3.0
1 stars 0 forks source link

Fix meter update serial number handling. #1488

Closed scsirdx closed 5 years ago

scsirdx commented 5 years ago

If wrong serial number is used on discovergy meter during update, server responds with Err500:

2018-10-10 19:22:25 INFO [services.datasource.discovergy.oauth] <3fd6b0a171bc> get https://api.discovergy.com/public/v1/oauth1/authorize?email=team%40localpool.de&oauth_token=b2c86000edb6424ea771222fc7bb6afa&password=[FILTERED]
2018-10-10 19:22:25 INFO [services.datasource.discovergy.oauth] <3fd6b0a171bc> Status
2018-10-10 19:22:25 +0300: Rack app error handling request { PATCH /api/admin/localpools/1/meters/26 }
#<URI::InvalidURIError: bad URI(is not URI?): /public/v1/last_reading?meterId=EASYMETER_###$#!%$@!%@$$@!!!!@!@!234324&fields=power>
/Users/dongeolog/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/uri/rfc3986_parser.rb:67:in `split'
/Users/dongeolog/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/uri/rfc3986_parser.rb:73:in `parse'
/Users/dongeolog/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/uri/common.rb:227:in `parse'

It should respond with 422, and proper error for serial number field.

mguentner commented 5 years ago

I think that the error is not an HTTP but a URI exception. Should work now. Closing