Rollback all the previous transaction without error in Business central

The ERROR command is the correct approach. The tricky part is putting it in the right place. You need to collect and display your info before tripping the error. HINT: ERROR will not rollback temporary records.