commit | author | age
|
2d8187
|
1 |
package net.jacekk.bridge.android; |
JK |
2 |
|
ae5f07
|
3 |
import net.jacekk.bridge.BridgeInputException; |
JK |
4 |
import net.jacekk.bridge.R; |
|
5 |
|
|
6 |
import java.util.HashMap; |
|
7 |
import java.util.Map; |
|
8 |
|
2d8187
|
9 |
public class BridgeInputExceptionMapper { |
ae5f07
|
10 |
public static final Map<BridgeInputException.Error, Integer> errorMap; |
JK |
11 |
|
|
12 |
static { |
|
13 |
errorMap = new HashMap<>(); |
|
14 |
errorMap.put(BridgeInputException.Error.CONTRACT_LEVEL_INVALID, R.string.invalid_level); |
|
15 |
errorMap.put(BridgeInputException.Error.CONTRACT_SUIT_INVALID, R.string.invalid_color); |
|
16 |
errorMap.put(BridgeInputException.Error.CONTRACT_DOUBLE_INVALID, R.string.invalid_contract); |
|
17 |
errorMap.put(BridgeInputException.Error.PC_INVALID, R.string.invalid_pc); |
|
18 |
errorMap.put(BridgeInputException.Error.TRICKS_INVALID, R.string.invalid_tricks); |
|
19 |
errorMap.put(BridgeInputException.Error.PASSES_INVALID, R.string.invalid_passes); |
|
20 |
} |
|
21 |
|
|
22 |
public static int map(BridgeInputException e) { |
|
23 |
return errorMap.get(e.getError()); |
|
24 |
} |
2d8187
|
25 |
} |