@@ -505,7 +505,7 @@ func (h *Handler) handlePostFrame(w http.ResponseWriter, r *http.Request) {
505
505
}
506
506
_ , err = h .API .CreateFrame (r .Context (), indexName , frameName , req .Options )
507
507
if err != nil {
508
- switch err {
508
+ switch errors . Cause ( err ) {
509
509
case ErrIndexNotFound :
510
510
http .Error (w , err .Error (), http .StatusNotFound )
511
511
case ErrFrameExists :
@@ -661,7 +661,7 @@ func (h *Handler) handleGetFrameFields(w http.ResponseWriter, r *http.Request) {
661
661
662
662
fields , err := h .API .Fields (r .Context (), indexName , frameName )
663
663
if err != nil {
664
- switch err {
664
+ switch errors . Cause ( err ) {
665
665
case ErrIndexNotFound :
666
666
fallthrough
667
667
case ErrFrameNotFound :
@@ -751,7 +751,7 @@ func (h *Handler) handlePostFrameAttrDiff(w http.ResponseWriter, r *http.Request
751
751
752
752
attrs , err := h .API .FrameAttrDiff (r .Context (), indexName , frameName , req .Blocks )
753
753
if err != nil {
754
- switch err {
754
+ switch errors . Cause ( err ) {
755
755
case ErrFragmentNotFound :
756
756
http .Error (w , err .Error (), http .StatusNotFound )
757
757
default :
@@ -878,7 +878,7 @@ func (h *Handler) handlePostImport(w http.ResponseWriter, r *http.Request) {
878
878
}
879
879
880
880
if err := h .API .Import (r .Context (), req ); err != nil {
881
- switch err {
881
+ switch errors . Cause ( err ) {
882
882
case ErrIndexNotFound :
883
883
fallthrough
884
884
case ErrFrameNotFound :
@@ -931,7 +931,7 @@ func (h *Handler) handlePostImportValue(w http.ResponseWriter, r *http.Request)
931
931
}
932
932
933
933
if err = h .API .ImportValue (r .Context (), req ); err != nil {
934
- switch err {
934
+ switch errors . Cause ( err ) {
935
935
case ErrIndexNotFound :
936
936
fallthrough
937
937
case ErrFrameNotFound :
@@ -980,7 +980,7 @@ func (h *Handler) handleGetExportCSV(w http.ResponseWriter, r *http.Request) {
980
980
}
981
981
982
982
if err = h .API .ExportCSV (r .Context (), index , frame , view , slice , w ); err != nil {
983
- switch err {
983
+ switch errors . Cause ( err ) {
984
984
case ErrFragmentNotFound :
985
985
break
986
986
case ErrClusterDoesNotOwnSlice :
@@ -1131,7 +1131,7 @@ func (h *Handler) handlePostFrameRestore(w http.ResponseWriter, r *http.Request)
1131
1131
}
1132
1132
1133
1133
err = h .API .RestoreFrame (r .Context (), indexName , frameName , host )
1134
- switch err {
1134
+ switch errors . Cause ( err ) {
1135
1135
case nil :
1136
1136
break
1137
1137
case ErrFrameNotFound :
0 commit comments