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 11:54:02


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

Issue History

Date Modified Username Field Change
2019-01-07 09:49 fman New Issue
2019-05-09 06:28 dregad Assigned To => dregad
2019-05-09 06:28 dregad Status new => assigned
2019-05-09 06:28 dregad Target Version => 2.22.0
2019-05-09 06:28 dregad Summary More feedback on schema management => Improve plugin schema upgrade errors
2019-05-09 06:28 dregad Note Added: 0062046
2019-05-09 12:01 dregad Summary Improve plugin schema upgrade errors => Improve plugin schema upgrade error message
2019-05-09 12:08 dregad Note Added: 0062047
2019-05-29 09:24 dregad Changeset attached => MantisBT master 4cae8782
2019-05-29 09:24 dregad Status assigned => resolved
2019-05-29 09:24 dregad Resolution open => fixed
2019-05-29 09:24 dregad Fixed in Version => 2.22.0
2019-08-25 12:36 vboctor Status resolved => closed