try {
// Logic
} catch(exception e) {
ApexPages.addMessage(New ApexPages.Message(ApexPages.Severity.FATAL, 'whatever message you want'));
}