This chapter describes common errors and explains how to handle them with Visualize.js.
This chapter contains the following sections:
Error Properties
The properties structure for Generic Errors is defined as follows:
{
"title": "Generic Errors",
"description": "A JSON Schema describing Visualize Generic Errors",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"errorCode": {
"type": "string"
},
"message": {
"type": "string"
},
"parameters":{
"type": "array"
}
},
"required": ["errorCode", "message"]
}
|
Common Errors
The following table lists common errors, their messages, and causes.
Page or app not responding |
{no_message} - If your page or web application has stopped working without notification or errors, check that the server providing visualize.js is accessible and returning scripts. |
unexpected.error
|
An unexpected error has occurred - In most of cases this is either a JavaScript exception or an HTTP 500 (Internal Server Error) response from server. |
schema.validation.error
|
JSON schema validation failed: {error_message} - Validation against schema has failed. Check the validationError property in object for more details. |
unsupported.
configuration.error
|
{unspecified_message} - This error happens only when isolateDom = true and defaultJiveUi.enabled = true. These properties are mutually exclusive. |
authentication.error
|
Authentication error - Credentials are not valid or session has expired. |
container.not.found.error
|
Container was not found in DOM - The specified container was not found in the DOM:error. |
report.execution.failed
|
Report execution failed - The report failed to run on the server. |
report.execution.cancelled
|
Report execution was canceled - Report execution was canceled. |
report.export.failed
|
Report export failed - The report failed to export on the server. |
licence.not.found
|
JRS missing appropriate licence - The server's license was not found. |
licence.expired
|
JRS license expired - The server's license has expired |
resource.not.found
|
Resource not found in Repository - Either the resource doesn't exist in the repository or the user doesn't have permissions to read it. |
export.pages.out.range
|
Requested pages {0} out of range - The user requested pages that don't exist in the current export. |
input.controls.
validation.error
|
{server_error_message} - The wrong input control params were sent to the server. |
Catching Initialization and Authentication Errors
Visualize.js is designed to have many places where you can catch and handle errors. The visualize function definition, as shown in Contents of the Visualize.js Script, is:
function visualize(properties, callback, errorback, always){}
|
During intitialization and authentication, you can handle errors in the third parameter named errorback (an error callback). Your application would then have this structure:
visualize({
auth : { ...
}
}, function(){
// your application logic
}, function(err){
// handle all initialization and authentication errors here
})
|
Catching Search Errors
One way to handle search errors is to specify an error handler as the second parameter of run:
new ResourcesSearch({
server:"http://localhost:8080/jasperserver-pro",
folderUri: "/public",
recursive: false
})).run( usefulFunction, function(error){
alert(error);
}))
|
Another way to handle search errors is to specify a function as the third parameter of run. This function is an always handler that runs every time when operation ends.
new ResourcesSearch({
server:"http://localhost:8080/jasperserver-pro",
folderUri: "/public",
recursive: false
})).run(usefulFunction, errorHandler, function(resultOrError){
alert(resultOrError);
}))
|
Validating Search Properties
You can also validate the structure of the search properties without making an actual call to the search function:
var call = new ResourcesSearch({
server:"http://localhost:8080/jasperserver-pro",
folderUri: "/public",
recursive: false
}));
var error = call.validate();
if (!error){
// valid
} else {
// invalid, read details from error
}
|
Catching Report Errors
To catch and handle errors when running reports, define the contents of the err function as shown in the following sample:
visualize({
auth : { ...
}
}, function(v){
var report = v.report({
error: function(err){
// invoked once report is initialized and has run
}
});
report
.run()
.fail(function(err){
// handle errors here
});
)
|
Catching Input Control Errors
Catching and handling input control errors is very similar to handling report errors. Define the contents of the err function that gets invoked in error conditions, as shown in the following sample:
visualize({
auth : { ...
}
}, function(v){
var ic = v.inputControls({
error: function(err){
// invoked once input control is initialized
}
});
inputControls
.run()
.fail(function(err){
// handle errors here
});
)
|
Validating Input Controls
You can also validate the structure of your input controls without making an actual call. However, the values of the input controls and their relevance to the named resource are not checked.
var ic = new InputControls({
server: "http://localhost:8080/jasperserver-pro",
resource: "/public/my_report",
params: {
"Country_multi_select":["Mexico"],
"Cascading_state_multi_select":["Guerrero", "Sinaloa"]
}
});
var error = ic.validate();
if (!error){
// valid
} else {
// invalid, read details from error
}
|