Commit Graph

40 Commits (4acc7330198279f464de0935f6a69ce7bfe7ead0)

Author SHA1 Message Date
Sam Arnold 5015297d40
fix: more expressive errors (#22448)
* fix: more expressive errors

Closes #22446

* fix: server only logging for untyped errors

* chore: fix formatting
2021-09-13 15:12:35 -04:00
Daniel Moran 00afd95cb7
refactor: automated move of errors and id from root to kit (#21101)
Co-authored-by: Sam Arnold <sarnold@influxdata.com>
2021-03-30 14:10:02 -04:00
George 67307d804e
chore(errors): interpret more cases as influxdb error type in http.CheckError (#17888) 2020-04-30 17:55:17 +01:00
Jonathan A. Sternberg 0ae8bebd75
refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
Johnny Steenbergen e650c941c7 fix: remove duplicate content types from httpc requests
2 issues from investigating this error. First is the status check func
did not identify it was a media unsupported issue adn tries to unmarshal
the empty response body. The 2nd, was the double content type headers were
causing an error. Locally this error does not surface, cannot repoduce on
macos, but in cloud it is persistent.

closes: #16819
2020-02-11 11:14:44 -08:00
Johnny Steenbergen 2b0b32abe8 chore(http): pull out eror handler into kit pkg for portability 2020-02-03 12:39:47 -08:00
George a0c18c9ef7
feat(http): add configurable limit to points batch size on write endpoint (#16469) 2020-01-10 11:02:44 +00:00
Brandon Farmer d83fabeabc feat(influxdb): user disabling 2019-09-23 11:57:16 -07: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
Jonathan A. Sternberg cb9d8eafe7
fix(http): use the content type header to determine how to parse http errors (#14596)
This will only attempt to parse an error as JSON if it has the content
type `application/json` so that it stops trying to parse the result as
JSON when it isn't JSON.

While the real error message is included, the addition of the "could not
parse json" makes it very confusing to read and distracts from the real
issue.
2019-08-08 14:23:43 -05:00
Kelvin Wang 9ecada4dce feat(http): convert errorEncode to use interface 2019-06-26 21:41:01 -04:00
Jonathan A. Sternberg 01e3317b02
fix(http): do not discard non-json encoded errors when using `CheckError` (#13844)
If the error returned was normal text instead of JSON, the JSON parsing
would fail and the JSON error would be returned instead of the actual
error.

This has been modified so that when it fails to parse the text as JSON,
it will construct an error with the actual text and then wrap it using
the JSON error.
2019-05-13 12:02:05 -05:00
Jade McGough 64ca8b6f08 chore(http): add 429 response to errors 2019-04-16 16:50:35 -07:00
Kelvin Wang 4e7785d92c update(http): changes based on review 2019-01-25 10:31:25 -08:00
Kelvin Wang f99f4759fa fix(http): fix task errors 2019-01-25 10:31:24 -08:00
Kelvin Wang 875162abd3 update(http): remove check error true 2019-01-25 10:29:27 -08:00
Kelvin Wang 79ce30691e update(http): remove kerrors, change the default to be influxdb error 2019-01-25 10:29:26 -08:00
Delmer e2ffc17b21
fix(ui): add session timeout notification (#11281)
Co-authored-by: Chris Goller <goller@gmail.com>
2019-01-18 17:43:00 -05: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
zhulongcheng e73d4fc637 add MethodNotAllowed handler 2018-12-23 15:55:45 +08:00
Michael Desa a941e881c6 fix(http): use platform.Error instead of old style error 2018-12-20 11:11:09 -05:00
zhulongcheng 5f40883342 add custom-404 handler 2018-12-16 22:55:39 +08:00
Kelvin Wang ee6b149c79 fix(http): fix the correct response 2018-12-07 10:07:38 -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
kelwang 3fed14dabc
Merge pull request #943 from influxdata/feat/inmem_onboarding_basic_auth
add inmem service for basic auth, http onboarding testing
2018-11-02 13:22:00 -04:00
Kelvin Wang 63da5d1e9f (feat/testing) add onboarding and basic auth service 2018-11-02 12:20:45 -04:00
Kelvin Wang cb4e095463 fix the error code for 400 2018-11-02 11:28:39 -04:00
Kelvin Wang 5378fe877a (fix/http): make error compatible with new and old lib 2018-11-01 20:28:40 -04:00
Chris Goller e621ed8e72 fix(http): all DELETEs now return 204 2018-10-29 14:10:33 -05:00
Chris Goller d2ecf8aad6 http(write): support timestamp precision 2018-10-25 21:23:50 -05:00
Michael Desa 42ba7ffe11 feat(http): add authentication handler middleware 2018-10-02 14:11:44 -04:00
Jade McGough 43e0d143e7
chore(http): return early if a critical error occurs in write path org/bucket lookup (#767) 2018-09-05 15:53:57 -07:00
Michael Desa 8bc2d33b78 feat(platform): move chronogaf v2 dashboards to platform
test(testing): add tests for dashboards and cells

test(bolt): all conformance tests for dashbaords and cells

fix(bolt): rename dashboardV2Bucket to dashboardBucket

feat(chronograf): introduce v2 dashboards

Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com>
Co-authored-by: Michael Desa <mjdesa@gmail.com>

chore(chronograf): add tests for v2 dashboard reducer

Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com>
Co-authored-by: Michael Desa <mjdesa@gmail.com>

chore(chronograf): create dashboard from dashboard index

Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com>
Co-authored-by: Michael Desa <mjdesa@gmail.com>

chore(chronograf): move tests to same level of heirarchy as file tested

chronograf(chore): implement import dashboard with v2 api

chore(chronograf): delete dashboards from v2 api

chore(chronograf): add source health handler

chore(chronograf): move sources reducer to sources dir

chore(chronograf): remove stutter in notify

WIP stop namespacing by sourceID

chore(chronograf): no longer namespace routes under sources/:sourceID

WIP move dashtimeV1 to ranges

WIP remove CEO

chrore(chronograf): WIP Remove CEO and QueryMaker

chore(chronograf): introduce updateDashboard v2

chore(chronograf): Change cell to view

A dashboard's cell object now only contains positional information
for the cell in it's grid and a reference to the cell's view data.
A cell's view contains all necessary information for the cell's
visualization.

Add react-grid-layout types

chore(chronograf): introduce add cell

chore(chronograf): fix type errors

Not on DashboardPage

feat(platform): add cell methods to dashboard service interface

feat(mock): update dashboard service with cell methods

feat(testing): add cell methods to testing package

feat(bolt): add dashboard cell methods to bolt dashbaord service

feat(http): add cell routes to dashbaord handler

feat(platform): add dependent create/destroy of views from cells

chore(chronograf): introduce update dashboard cells endpoint

WIP update cells FE

fix(http): rename Cells to cells on dashboard cells response

chore(chronograf): re-introduce dashboard cell dragging

feat(platform): add copy dashboard cell to dashboard service

chore(platform): rename cell to view across codebase

feat(bolt): add replace dashboard tests

Move Layouts to Cells

Introduce delete cell

Fix broken test

fix(platform): update route for copying a a dashboard cell

UI for delete cell

Introduce copy cell

feat(platform): add copy view options to AddDashboardCell

feat(bolt): delete views when dashboard is removed.

Cleanup

Fix type errors

Fix links not updating

Remove annotations from RefreshingGraph

Sources and types work

fix(platform): add TODO.go files back

fix(view): rename visualizationType to type in view JSON

Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
Co-authored-by: Michael Desa <mjdesa@gmail.com>

fix(dashboardTime): change dashboardID to string

Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
Co-authored-by: Michael Desa <mjdesa@gmail.com>

feat(http): add dashboard api to swagger documentation

review(http): fix comments and function naming

feat(http): update sources swagger documentation

review(http): update the swagger to reflect the implementation

feat(platform): add usingView options to POST /dashboard/:id/cells
2018-08-24 13:22:58 -04:00
Lyon Hill f718b9cdca
feat(task): create validation layer for TaskService (#591)
* feat(task): create validation layer for TaskService
2018-08-20 15:15:04 -06:00
Mark Rushakoff faf5408a7b fix(http): increase errorHeaderMaxLength
The limit was introduced in 510325ea5c but
it didn't specify why 64 was chosen.

According to https://stackoverflow.com/a/6160643, we should be able to
assume at least 8kb of space for HTTP headers, so I'm assuming 256 bytes
should be sufficient to avoid truncating most error messages, without
being likely to hit the total HTTP header limit.

Fixes #530.
2018-08-01 16:04:36 -07:00
Nathaniel Cook b63394da0a fix(errors): Update Fluxd errors
This PR also completes some TODOs about kit/errors and http/errors.
2018-06-28 16:56:35 -06:00
Jonathan A. Sternberg 48ece5136f feat(http): add a utility function for reading http errors
This also modifies the http error encoder to not include the reference
code in the `X-Influx-Error` message so it only includes the text.
2018-05-23 13:29:48 -05:00