| 1 | /* |
| 2 | * $Id: Win32Exception.java,v 1.1.1.5 2004/05/25 20:23:27 hastings Exp $ |
| 3 | * |
| 4 | * (c) Copyright, Moebius Solutions, Inc., 2004 |
| 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This material may be reproduced by or for the U. S. Government |
| 9 | * pursuant to the copyright license under the clause at |
| 10 | * DFARS 252.227-7014 (OCT 2001). |
| 11 | */ |
| 12 | |
| 13 | package com.moesol.bindings.platform_sdk.windows_api; |
| 14 | |
| 15 | /** |
| 16 | * @author robert |
| 17 | */ |
| 18 | public class Win32Exception extends RuntimeException { |
| 19 | |
| 20 | /** |
| 21 | * |
| 22 | */ |
| 23 | public Win32Exception() { |
| 24 | super(); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * @param message |
| 29 | */ |
| 30 | public Win32Exception(String message) { |
| 31 | super(message); |
| 32 | } |
| 33 | public Win32Exception(int lresult) { |
| 34 | m_lresult = lresult; |
| 35 | } |
| 36 | /* (non-Javadoc) |
| 37 | * @see java.lang.Throwable#getMessage() |
| 38 | */ |
| 39 | public String getMessage() { |
| 40 | if (m_message != null) { |
| 41 | return m_message; |
| 42 | } |
| 43 | |
| 44 | String msg = super.getMessage(); |
| 45 | if (msg == null || msg.length() == 0) { |
| 46 | msg = PlatformSDK.FormatMessage(m_lresult); |
| 47 | } |
| 48 | |
| 49 | m_message = msg; |
| 50 | return m_message; |
| 51 | } |
| 52 | public int getLRESULT() { |
| 53 | return m_lresult; |
| 54 | } |
| 55 | |
| 56 | private int m_lresult = 0; |
| 57 | private String m_message = null; |
| 58 | } |