@Override
    public BackgroundException map(final String message, final ApiException failure, final Path file) {
        if(null != failure.getResponseBody()) {
            try {
                final JsonObject json = JsonParser.parseReader(new StringReader(failure.getResponseBody())).getAsJsonObject();
                if(json.has("errorCode")) {
                    if(json.get("errorCode").isJsonPrimitive()) {
                        final int errorCode = json.getAsJsonPrimitive("errorCode").getAsInt();
                        switch(failure.getCode()) {
                            case HttpStatus.SC_NOT_FOUND:
                                switch(errorCode) {
                                    // "debugInfo":"Node not found","errorCode":-41000
                                    case -41000:
                                        // "debugInfo":"File not found","errorCode":-40751
                                    case -40751:
                                        // Invalidate cache on Node not found
                                        fileid.cache(file, null);
                                        break;
                                }
                                break;
                        }
                    }
                }
            }
            catch(JsonParseException e) {
                // Ignore
            }
        }
        return super.map(message, failure, file);
    }
@Test
    public void testMap() {
        final BackgroundException e = new SDSExceptionMappingService(new SDSNodeIdProvider(
                new SDSSession(new Host(new SDSProtocol()), new DisabledX509TrustManager(), new DefaultX509KeyManager())
        )).map(new ApiException("m", 403, Collections.emptyMap(),
                "{\"errorCode\" = -40761}"));
        assertEquals("Error -40761. Please contact your web hosting service provider for assistance.", e.getDetail());
    }