@@ -80,9 +80,9 @@ def select_db():
80
80
path = request .args .get ('path' )
81
81
db = request .args .get ('db' )
82
82
if path is None :
83
- abort (400 )
83
+ abort (400 , "'path' argument is missing" )
84
84
if db not in current_app .old_config .databases :
85
- abort (404 )
85
+ abort (404 , "'db' argument is missing or invalid" )
86
86
87
87
# Rewrite the path.
88
88
new_path = "/db_%s" % db
@@ -315,7 +315,7 @@ def v4_machine(id):
315
315
try :
316
316
machine = session .query (ts .Machine ).filter (ts .Machine .id == id ).one ()
317
317
except NoResultFound :
318
- abort (404 )
318
+ abort (404 , "Invalid machine id {}" . format ( id ) )
319
319
320
320
if request .args .get ('json' ):
321
321
json_obj = dict ()
@@ -350,7 +350,7 @@ def __init__(self, run_id):
350
350
self .ts = ts = request .get_testsuite ()
351
351
self .run = run = session .query (ts .Run ).filter_by (id = run_id ).first ()
352
352
if run is None :
353
- abort (404 )
353
+ abort (404 , "Invalid run id {}" . format ( run_id ) )
354
354
355
355
# Get the aggregation function to use.
356
356
aggregation_fn_name = request .args .get ('aggregation_fn' )
@@ -616,7 +616,7 @@ def v4_order(id):
616
616
# Get the order.
617
617
order = session .query (ts .Order ).filter (ts .Order .id == id ).first ()
618
618
if order is None :
619
- abort (404 )
619
+ abort (404 , "Invalid order id {}" . format ( id ) )
620
620
621
621
previous_order = None
622
622
if order .previous_order_id :
@@ -646,7 +646,7 @@ def v4_set_baseline(id):
646
646
ts = request .get_testsuite ()
647
647
base = session .query (ts .Baseline ).get (id )
648
648
if not base :
649
- return abort (404 )
649
+ return abort (404 , "Invalid baseline id {}" . format ( id ) )
650
650
flash ("Baseline set to " + base .name , FLASH_SUCCESS )
651
651
flask .session [baseline_key (ts .name )] = id
652
652
@@ -674,7 +674,7 @@ def v4_run_graph(id):
674
674
ts = request .get_testsuite ()
675
675
run = session .query (ts .Run ).filter_by (id = id ).first ()
676
676
if run is None :
677
- abort (404 )
677
+ abort (404 , "Invalid run id {}" . format ( id ) )
678
678
679
679
# Convert the old style test parameters encoding.
680
680
args = {'highlight_run' : id }
@@ -722,7 +722,7 @@ def v4_graph_for_sample(sample_id, field_name):
722
722
ts = request .get_testsuite ()
723
723
target_sample = session .query (ts .Sample ).get (sample_id )
724
724
if not target_sample :
725
- abort (404 , "Could not find sample id: {}" .format (sample_id ))
725
+ abort (404 , "Could not find sample id {}" .format (sample_id ))
726
726
727
727
# Get the field index we are interested in.
728
728
field_index = None
@@ -814,19 +814,26 @@ def v4_graph():
814
814
test_id = int (test_id_str )
815
815
field_index = int (field_index_str )
816
816
except ValueError :
817
- return abort (400 )
817
+ return abort (400 , "Parameter {} was malformed. {} must be int.int.int" \
818
+ .format (name , value ))
818
819
819
820
if not (0 <= field_index < len (ts .sample_fields )):
820
- return abort (404 )
821
+ return abort (404 , "Invalid field index {}" . format ( field_index ) )
821
822
822
823
try :
823
824
machine = session .query (ts .Machine ) \
824
825
.filter (ts .Machine .id == machine_id ) \
825
826
.one ()
827
+ except NoResultFound :
828
+ return abort (404 , "Invalid machine id {}" .format (machine_id ))
829
+ try :
826
830
test = session .query (ts .Test ).filter (ts .Test .id == test_id ).one ()
831
+ except NoResultFound :
832
+ return abort (404 , "Invalid test id {}" .format (test_id ))
833
+ try :
827
834
field = ts .sample_fields [field_index ]
828
835
except NoResultFound :
829
- return abort (404 )
836
+ return abort (404 , "Invalid field_index {}" . format ( field_index ) )
830
837
graph_parameters .append (GraphParameter (machine , test , field , field_index ))
831
838
832
839
# Order the plots by machine name, test name and then field.
@@ -848,17 +855,18 @@ def v4_graph():
848
855
machine_id = int (machine_id_str )
849
856
field_index = int (field_index_str )
850
857
except ValueError :
851
- return abort (400 )
858
+ return abort (400 , "Parameter {} was malformed. {} must be int.int" \
859
+ .format (name , value ))
852
860
853
861
if not (0 <= field_index < len (ts .sample_fields )):
854
- return abort (404 )
862
+ return abort (404 , "Invalid field index {}" . format ( field_index ) )
855
863
856
864
try :
857
865
machine = session .query (ts .Machine ) \
858
866
.filter (ts .Machine .id == machine_id ) \
859
867
.one ()
860
868
except NoResultFound :
861
- return abort (404 )
869
+ return abort (404 , "Invalid machine id {}" . format ( machine_id ) )
862
870
field = ts .sample_fields [field_index ]
863
871
864
872
mean_parameter = (machine , field )
@@ -882,7 +890,7 @@ def v4_graph():
882
890
try :
883
891
run_id = int (run_id_str )
884
892
except Exception :
885
- return abort (400 )
893
+ return abort (400 , "Invalid baseline run id {}" . format ( run_id_str ) )
886
894
887
895
try :
888
896
run = session .query (ts .Run ) \
@@ -905,7 +913,7 @@ def v4_graph():
905
913
highlight_run = session .query (ts .Run ).filter_by (
906
914
id = int (highlight_run_id )).first ()
907
915
if highlight_run is None :
908
- abort (404 )
916
+ abort (404 , "Invalid highlight_run id {}" . format ( highlight_run_id ) )
909
917
910
918
# Find the neighboring runs, by order.
911
919
prev_runs = list (ts .get_previous_runs_on_machine (session ,
@@ -1708,32 +1716,32 @@ def v4_matrix():
1708
1716
test_id = int (test_id_str )
1709
1717
field_index = int (field_index_str )
1710
1718
except ValueError :
1711
- err_msg = "data {} was malformed. {} must be int.int.int"
1719
+ err_msg = "Parameter {} was malformed. {} must be int.int.int"
1712
1720
return abort (400 , err_msg .format (name , value ))
1713
1721
1714
1722
if not (0 <= field_index < len (ts .sample_fields )):
1715
- return abort (404 , "Invalid field index: {}" .format (field_index ))
1723
+ return abort (404 , "Invalid field index {}" .format (field_index ))
1716
1724
1717
1725
try :
1718
1726
machine = session .query (ts .Machine ) \
1719
1727
.filter (ts .Machine .id == machine_id ) \
1720
1728
.one ()
1721
1729
except NoResultFound :
1722
- return abort (404 , "Invalid machine ID: {}" .format (machine_id ))
1730
+ return abort (404 , "Invalid machine id {}" .format (machine_id ))
1723
1731
try :
1724
1732
test = session .query (ts .Test ).filter (ts .Test .id == test_id ).one ()
1725
1733
except NoResultFound :
1726
- return abort (404 , "Invalid test ID: {}" .format (test_id ))
1734
+ return abort (404 , "Invalid test id {}" .format (test_id ))
1727
1735
try :
1728
1736
field = ts .sample_fields [field_index ]
1729
1737
except NoResultFound :
1730
- return abort (404 , "Invalid field_index: {}" .format (field_index ))
1738
+ return abort (404 , "Invalid field_index {}" .format (field_index ))
1731
1739
1732
1740
valid_request = MatrixDataRequest (machine , test , field )
1733
1741
data_parameters .append (valid_request )
1734
1742
1735
1743
if not data_parameters :
1736
- abort (404 , "Request requires some data arguments." )
1744
+ abort (404 , "Request requires some plot arguments." )
1737
1745
# Feature: if all of the results are from the same machine, hide the name
1738
1746
# to make the headers more compact.
1739
1747
dedup = True
@@ -1775,7 +1783,7 @@ def v4_matrix():
1775
1783
all_orders .add (s [1 ])
1776
1784
order_to_id [s [1 ]] = s [2 ]
1777
1785
if not all_orders :
1778
- abort (404 , "No data found." )
1786
+ abort (404 , "No orders found." )
1779
1787
# Now grab the baseline data.
1780
1788
user_baseline = baseline ()
1781
1789
backup_baseline = next (iter (all_orders ))
0 commit comments