Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Fix unhandled error when match_all/match_any format is incorrect #978

Merged
merged 1 commit into from
May 2, 2019

Conversation

unnawut
Copy link
Contributor

@unnawut unnawut commented May 2, 2019

Issue/Task Number: #975
Closes #975

Overview

Fixes the internal server error returned when the provided with an invalid match_all/match_any filter attributes.

Changes

  • MatchParser rejects filter attributes that are invalid (i.e. not in a list).
  • Updated :missing_filter_param error description to "Invalid parameter provided. Expecting an array of filter parameters." for clarity

Implementation Details

Server was crashing because Enum.reduce_while/3 could be enumerated both over a list or a map. Since the expected value is a list, but a map could easily be mistaken (using only 1 set of filter, passed that set without wrapping in a list), this will be caught now before being handled.

Did this instead of supporting a single filter without list to keep the API consistent.

Usage

Request:

curl -X POST http://localhost:4000/api/admin/token.all \
-X POST \
-H "Accept: application/vnd.omisego.v1+json" \
-H "Authorization: OMGProvider <truncated>" \
-H "Content-Type: application/json" \
-d '{
  "match_all": {
    "comparator": "eq",
    "field": "symbol",
    "value": "ABC"
  }
}' \
-v -w "\n"

Response:

{
  "version": "1",
  "success": false,
  "data": {
    "object": "error",
    "messages": {},
    "description": "Invalid parameter provided. Expecting an array of filter parameters.",
    "code": "client:invalid_parameter"
  }
}

Impact

No changes to DB schema or API specs.

@unnawut unnawut self-assigned this May 2, 2019
@unnawut unnawut added this to the v1.2 milestone May 2, 2019
@unnawut unnawut added this to Review in eWallet May 2, 2019
@unnawut unnawut requested a review from T-Dnzt May 2, 2019 09:05
@unnawut unnawut merged commit d540a1c into omgnetwork:v1.2 May 2, 2019
eWallet automation moved this from Review to Done May 2, 2019
@unnawut unnawut deleted the 975-missing-filters branch May 2, 2019 13:01
jarindr added a commit that referenced this pull request May 13, 2019
* Minor bug fix (#970)

* fix missing admin

* no wrap row for fromto

* remove divider

* add color link

* fix test

* Update admin email (#966)

* call right endpoint

* split email avatar actions, seperate reducer for alert

* verify email call on redirect

* verifyemail action tests

* remove log, new redirect url

* QC 1.2 (#976)

* standardize buttons

* section titles

* allow disable hover effect and fix admin key table

* breadcruymb and refine input

* modal tweaks, end page 4 of review

* dropdown tweaks

* consistency for buttons

* reorder table, add suffix to config and remove native spinner

* ability to cancel changes in config pages and restore original state

* highlight selected row when activity tab open

* transaction request page clean

* cancel edit profile and clean

* render create exchange pair if many tokens

* breadcrumb to userdetail

* unify none state to - in tables

* handle disabled state on select

* css tweaks and new export layout

* seperate time out

* new exported range table

* tweaks and conditional breadcrumb

* remove divider

* account name bug

* rounding

* a not so configurable css tooltip

* cleaner conditional

* remove selectedrow state

* tweak select disabled

* fix edit account

* Handles incorrect non-list inputs for filters (#978)

* Fix exception raised when the given `start_by` field is not allowed (#986)

* Fix exception when the given pagination field is not allowed

* Fix exception when non-existing field name is provided

* Fix rate exchange bug (#984)

* fix rate bug

* fix topbar height bug

* remove more flex

* add max length for input

* fix icon

* fix width

* add max amount for input

* add props for input

* remove prefix

* remove log

* fix object

* bring back animation

* finally fix decimal problem

* fix formatter

* !!!!

* fix test

* to number of rate

* change length

* fix audit package

* rename admin panel to frontend (#997)

* rename to frontend

* test rename

* fix flex bug (#1003)

* fix conflict
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
eWallet
  
5-Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants