Hi,
I suppose that you use LPC55xx family, which has only one flash block, if you erase/program sector or page of the same block where you save code and execute, you will have issue. while the flash block is erased/programed by calling IAP function, you can not access the block, so you have to disable interrupt, but you use CAN non-blocking mechanism, which uses interrupt mechanism, it will leads to error.
If you want to erase/program flash and hope you can use interrupt mechanism, you have to copy the interrupt table to SRAM and copy the ISR to SRAM from flash, because core fetches interrupt table from RAM and execute code from RAM, it is okay, although you erase/program flash page or sector
Hope it can help you
BR
Xiangjun Rong