| 1 |
package rest |
| 2 |
|
| 3 |
import ( |
| 4 |
"fmt" |
| 5 |
"strings" |
| 6 |
) |
| 7 |
|
| 8 |
// BadRegionError indicates that: |
| 9 |
// - the requested Region cannot be used with this API |
| 10 |
// - other Regions _can_ be used with this API |
| 11 |
type BadRegionError struct { |
| 12 |
RequestedRegion string |
| 13 |
AvailableRegions []string |
| 14 |
err error |
| 15 |
} |
| 16 |
|
| 17 |
func (e *BadRegionError) Error() string { |
| 18 |
return fmt.Sprintf( |
| 19 |
"invalid region %q, available regions are [%s]: %v", |
| 20 |
e.RequestedRegion, strings.Join(e.AvailableRegions, ", "), e.err, |
| 21 |
) |
| 22 |
} |
| 23 |
|
| 24 |
func (e *BadRegionError) Unwrap() error { |
| 25 |
return e.err |
| 26 |
} |