[ML] Improve error on get calendar when ml-meta index is missing (elastic/x-pack-elasticsearch#3576)
Relates elastic/x-pack-elasticsearch#3016 Original commit: elastic/x-pack-elasticsearch@bc60a0cb72
This commit is contained in:
parent
ac2884f034
commit
2350b85507
|
@ -51,6 +51,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
|
import org.elasticsearch.index.IndexNotFoundException;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
|
@ -1204,7 +1205,11 @@ public class JobProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Exception e) {
|
public void onFailure(Exception e) {
|
||||||
listener.onFailure(e);
|
if (e instanceof IndexNotFoundException) {
|
||||||
|
listener.onFailure(new ResourceNotFoundException("No calendar with id [" + calendarId + "]"));
|
||||||
|
} else {
|
||||||
|
listener.onFailure(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
client::get);
|
client::get);
|
||||||
|
|
|
@ -92,6 +92,13 @@
|
||||||
"job_ids": ["cal-job", "unknown-job"]
|
"job_ids": ["cal-job", "unknown-job"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
---
|
||||||
|
"Test get calendar given missing":
|
||||||
|
- do:
|
||||||
|
catch: /No calendar with id \[unknown\]/
|
||||||
|
xpack.ml.get_calendars:
|
||||||
|
calendar_id: "unknown"
|
||||||
|
|
||||||
---
|
---
|
||||||
"Test PageParams":
|
"Test PageParams":
|
||||||
- do:
|
- do:
|
||||||
|
|
|
@ -20,6 +20,7 @@ integTestRunner {
|
||||||
'ml/ml_classic_analyze/Test analyze API with an analyzer that does what we used to do in native code',
|
'ml/ml_classic_analyze/Test analyze API with an analyzer that does what we used to do in native code',
|
||||||
// Remove tests that are expected to throw an exception, because we cannot then
|
// Remove tests that are expected to throw an exception, because we cannot then
|
||||||
// know whether to expect an authorization exception or a validation exception
|
// know whether to expect an authorization exception or a validation exception
|
||||||
|
'ml/calendar_crud/Test get calendar given missing',
|
||||||
'ml/calendar_crud/Test cannot create calendar with name _all',
|
'ml/calendar_crud/Test cannot create calendar with name _all',
|
||||||
'ml/calendar_crud/Test PageParams with ID is invalid',
|
'ml/calendar_crud/Test PageParams with ID is invalid',
|
||||||
'ml/calendar_crud/Test post calendar events given empty events',
|
'ml/calendar_crud/Test post calendar events given empty events',
|
||||||
|
|
Loading…
Reference in New Issue