Commit Graph

20 Commits (ab87c23be6c630754787dcd9113cd86bd6afaaf1)

Author SHA1 Message Date
Stuart Carnie 9c4dfed391 feat: Add ENotImplemented error code
This is more explicit that EInternal, allowing APIs to indicate
a potentially temporary status of "501 Not implemented"
2020-09-24 11:11:46 -07:00
George a0c18c9ef7
feat(http): add configurable limit to points batch size on write endpoint (#16469) 2020-01-10 11:02:44 +00:00
Jonathan A. Sternberg cbd04f2884
refactor: http error serialization matches the new error schema (#15196)
The http error schema has been changed to simplify the outward facing
API. The `op` and `error` attributes have been dropped because they
confused people. The `error` attribute will likely be readded in some
form in the future, but only as additional context and will not be
required or even suggested for the UI to use.

Errors are now output differently both when they are serialized to JSON
and when they are output as strings. The `op` is no longer used if it is
present. It will only appear as an optional attribute if at all. The
`message` attribute for an error is always output and it will be the
prefix for any nested error. When this is serialized to JSON, the
message is automatically flattened so a nested error such as:

    influxdb.Error{
        Msg: errors.New("something bad happened"),
        Err: io.EOF,
    }

This would be written to the message as:

    something bad happened: EOF

This matches a developers expectations much more easily as most
programmers assume that wrapping an error will act as a prefix for the
inner error.

This is flattened when written out to HTTP in order to make this logic
immaterial to a frontend developer.

The code is still present and plays an important role in categorizing
the error type. On the other hand, the code will not be output as part
of the message as it commonly plays a redundant and confusing role when
humans read it. The human readable message usually gives more context
and a message like with the code acting as a prefix is generally not
desired. But, the code plays a very important role in helping to
identify categories of errors and so it is very important as part of the
return response.
2019-09-19 10:06:47 -05:00
Kelvin Wang 4a75004bd7 feat(influxdb):add http error handler interface 2019-06-26 21:39:21 -04:00
Jade McGough 64ca8b6f08 chore(http): add 429 response to errors 2019-04-16 16:50:35 -07:00
Mark Rushakoff 290d06f98f fix(swagger): synchronize enum with defined error constants 2019-03-01 11:58:11 -08:00
Kelvin Wang 79ce30691e update(http): remove kerrors, change the default to be influxdb error 2019-01-25 10:29:26 -08:00
Michael Desa bfb865cd72 feat(influxdb): authorize org service operations
feat(influxdb): add unauthorized error code

feat(testing): export ErrorsEqual method

feat(authorizer): add Authorize method that authorizers permissions

feat(authorizer): add org service that authorizes actions to a wrapped org service

feat(http): use authorized org service in org handler

feat(authorizer): rename Authorize to IsAllowed
2019-01-16 14:41:57 -05:00
Mark Rushakoff d73d73c0d4 chore: rename imports from platform to influxdb
I did this with a dumb editor macro, so some comments changed too.

Also rename root package from platform to influxdb.

In interest of minimizing risk, anyone importing the root package has
now aliased it to "platform" so that no changes beyond imports were
necessary in those files.

Lastly, replace the old platform module to local path /dev/null so that
nobody can accidentally reintroduce a platform dependency while
migrating platform code to influxdb.
2019-01-09 20:51:47 -08:00
Michael Desa 338e0587d0 fix(platform): nest view beneath dashboard cell
feat(platform): add functional options for platform errors

fix(testing): set dashboard ids properly in dashboard tests

feat(bolt): add dashboard specific views

fix(bolt): delete view when cell is removed or dashboard is deleted
2019-01-08 18:11:13 -05:00
Michael Desa b590259a97 fix(platform): check for (*platform.Error)(nil) in error functions
As of https://github.com/influxdata/platform/pull/2192 a panic was
introduced in the startup of platform. It is the result of
`Error{Code,Op,Message}` being passed a `(*platform.Error)(nil)`
instead of an `(error)(nil)`.

Specifically
```
   if err == nil {
        return ""
    } else if e, ok := err.(*Error); ok && e.Code != "" {
        return e.Code
    }
```
will panic when err is `(*platform.Error)(nil)` as the `err == nil`
check will fail and the `e, ok := err.(*Error); ok && e.Code != ""` will
succeed and panic on `e.Code`, as `e` is nil.

This panic could have been avoided if all methods returned `error`
instead of `*platform.Error`.
2019-01-04 11:02:26 -05:00
zhulongcheng f3bf670706 rename msg to message for platform.Error json 2018-12-27 10:34:00 +08:00
zhulongcheng e73d4fc637 add MethodNotAllowed handler 2018-12-23 15:55:45 +08:00
Michael Desa 9d1ed7a8d6 fix(platform): rename "msg" field to "message" for Error json 2018-12-19 13:13:15 -05:00
Kelvin Wang d939732141 fix(platform): use json struct instead of string for embed error 2018-12-17 11:18:04 -05:00
Kelvin Wang 25eebd0084 fix(http): convert auth errors 2018-11-16 19:33:20 -05:00
Kelvin Wang 8d15d70360 fix(http): convert auth errors 2018-11-16 19:30:34 -05:00
Chris Goller 6054288f3e feat(kit/grpc): add translation between gRPC status and platform.Error 2018-11-15 21:16:48 -06:00
Kelvin Wang 3552af6386 feat: add onboarding defaults 2018-09-27 15:02:17 -04:00
Kelvin Wang 4cd8a48c39 feat(errors): add errors lib 2018-09-07 21:45:47 -05:00