MQ : error while browsing queues

I am trying browse a queue which has write only permissions and I am trying to catch an exception in catch block and print a message that the queus has only wite permissions in system log depending on the reason code.