View Issue Details

IDProjectCategoryView StatusLast Update
0025162mantisbtplug-inspublic2019-08-25 12:36
Reporterfman Assigned Todregad  
Status closedResolutionfixed 
Product Version2.19.0 
Target Version2.22.0Fixed in Version2.22.0 
Summary0025162: Improve plugin schema upgrade error message

While developing plugins is easier to have issues due to minor errors.
I've found difficult to understand what is happening when I got an error like:

<b>Upgrading the plugin schema failed in block #10<b>

After digging a little bit on the code I've understood that the #NUMBER is the element of the array returned by the schema() that I've created.
IMHO may be the word block can be changed to something a little bit clear.

My proposal is a silly one:
adding the offending sentence ($t_sqlarray)

    if( 2 == $t_status ) {
        plugin_config_set( 'schema', $i );
    } else {
        <b>error_parameters( $i . ' SQL: ' . json_encode($t_sqlarray) );</b>
        trigger_error( ERROR_PLUGIN_UPGRADE_FAILED, ERROR );
        return null;


TagsNo tags attached.




2019-05-09 06:28

developer   ~0062046

I agree that providing details / context about the error would be a useful addition to plugin API.

Displaying the offending SQL statement would be useful for context, but I don't think that the suggestion to insert JSON within the error message is the right approach.

It would be even more useful to provide the actual error message returned by the DB (i.e. $g_db->errorMsg()).



2019-05-09 12:08

developer   ~0062047


Related Changesets

MantisBT: master 4cae8782

2019-05-09 07:54


Details Diff
Improve plugin schema upgrade error message

The message now includes the actual database error, as well as the
offending SQL statement.

Fixes 0025162
Affected Issues
mod - core/plugin_api.php Diff File
mod - lang/strings_english.txt Diff File