Revision 9524 branches/piloto3d/libraries/libFMap/src/com/iver/cit/gvsig/fmap/DriverException.java
DriverException.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.fmap; |
42 | 42 |
|
43 |
import com.iver.utiles.ExceptionDescription; |
|
44 |
import com.iver.utiles.IDescriptableException; |
|
45 |
|
|
43 | 46 |
/** |
44 | 47 |
* Excepci?n que indica un problema con los drivers. El problema concreto viene |
45 | 48 |
* dado por la excepci?n hija |
46 | 49 |
*/ |
47 |
public class DriverException extends Exception { |
|
50 |
public class DriverException extends Exception implements IDescriptableException{ |
|
51 |
|
|
52 |
/* |
|
53 |
* azabala. |
|
54 |
* El problema que tenemos es que una DriverException puede ser debida |
|
55 |
* a multiples causas, y para poder mostrar al usuario informaci?n de cara |
|
56 |
* a que subsane estas causas (sobretodo considerando el estado UnAvalaible |
|
57 |
* de un FLayer) seria necesario hacer un analisis exhaustivo de estas causas. |
|
58 |
* |
|
59 |
* Por este motivo a?ado un ExceptionDescription a DriverException |
|
60 |
* (si finalmente DriverIOException tb lo requiere, habr?a que meter herencias) |
|
61 |
* que S? que tiene esta inforamaci?n. |
|
62 |
* |
|
63 |
*/ |
|
48 | 64 |
/** |
65 |
* It has information about the cause of the DriverException |
|
66 |
* (and an error message to the user) |
|
67 |
*/ |
|
68 |
private ExceptionDescription exceptionType; |
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
/** |
|
49 | 73 |
* Crea un nuevo DriverException |
50 | 74 |
* |
51 | 75 |
* @param message |
... | ... | |
53 | 77 |
public DriverException(String message) { |
54 | 78 |
super(message); |
55 | 79 |
} |
80 |
|
|
81 |
public DriverException(String message, ExceptionDescription type){ |
|
82 |
super(message); |
|
83 |
this.exceptionType = type; |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* New constructor to specify ExceptionDescription |
|
88 |
* @param message |
|
89 |
* @param cause |
|
90 |
* @param exceptionType |
|
91 |
*/ |
|
92 |
public DriverException(String message, |
|
93 |
Throwable cause, |
|
94 |
ExceptionDescription exceptionType){ |
|
95 |
super(message, cause); |
|
96 |
this.exceptionType = exceptionType; |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* Returns the ExceptionDescription associated to this DriverException |
|
101 |
* @return |
|
102 |
*/ |
|
103 |
public ExceptionDescription getExceptionType(){ |
|
104 |
if(exceptionType != null) |
|
105 |
return exceptionType; |
|
106 |
else return null; |
|
107 |
// else |
|
108 |
// return ExceptionDescription.getType("GENERIC"); |
|
109 |
} |
|
110 |
|
|
56 | 111 |
|
57 | 112 |
/** |
58 | 113 |
* Crea un nuevo DriverException |
... | ... | |
72 | 127 |
public DriverException(Throwable cause) { |
73 | 128 |
super(cause); |
74 | 129 |
} |
130 |
|
|
131 |
public DriverException(Throwable cause, ExceptionDescription type){ |
|
132 |
super(cause); |
|
133 |
this.exceptionType = type; |
|
134 |
} |
|
75 | 135 |
} |
Also available in: Unified diff