| | | 1 | | namespace Elsa.Bpmn.Interchange.Exceptions; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Thrown when a workflow definition cannot be exported as BPMN 2.0 XML because the source this deployment would |
| | | 5 | | /// need to write back out is missing or no longer trustworthy. |
| | | 6 | | /// </summary> |
| | | 7 | | /// <remarks> |
| | | 8 | | /// See <see cref="Services.BpmnInterchangeDocumentService"/>'s remarks for the distinct situations this covers — a |
| | | 9 | | /// definition never imported from BPMN (or one whose source a later save dropped), one whose source predates the |
| | | 10 | | /// version marker needed to check it is still current, and one that has changed since it was imported — and why |
| | | 11 | | /// each gets its own message and its own <see cref="Reason"/>, which is what |
| | | 12 | | /// <c>Endpoints.Bpmn.BpmnExportErrorResponses</c> maps to the response's <see cref="Elsa.Bpmn.Interchange.BpmnErrorCode |
| | | 13 | | /// without having to parse the message. |
| | | 14 | | /// </remarks> |
| | | 15 | | public class BpmnExportUnavailableException : Exception |
| | | 16 | | { |
| | | 17 | | /// <summary>Creates the exception with <see cref="BpmnExportUnavailableReason.NotImported"/> as its reason.</summar |
| | 0 | 18 | | public BpmnExportUnavailableException(string message) : this(message, BpmnExportUnavailableReason.NotImported) |
| | | 19 | | { |
| | 0 | 20 | | } |
| | | 21 | | |
| | | 22 | | /// <summary>Creates the exception with an explicit <paramref name="reason"/>.</summary> |
| | 14 | 23 | | public BpmnExportUnavailableException(string message, BpmnExportUnavailableReason reason) : base(message) |
| | | 24 | | { |
| | 14 | 25 | | Reason = reason; |
| | 14 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary>Which of the situations this type's remarks describe <see cref="Exception.Message"/> reports.</summary> |
| | 7 | 29 | | public BpmnExportUnavailableReason Reason { get; } |
| | | 30 | | } |
| | | 31 | | |
| | | 32 | | /// <summary>The distinct situations a <see cref="BpmnExportUnavailableException"/> reports.</summary> |
| | | 33 | | public enum BpmnExportUnavailableReason |
| | | 34 | | { |
| | | 35 | | /// <summary>The definition does not currently carry BPMN source at all.</summary> |
| | | 36 | | NotImported, |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// The definition carries BPMN source but not the definition version it was recorded against, so whether that |
| | | 40 | | /// source is still current cannot be verified. |
| | | 41 | | /// </summary> |
| | | 42 | | SourceVersionUnknown, |
| | | 43 | | |
| | | 44 | | /// <summary>The definition has changed — by version, or (for an unpublished draft) by activity graph — since the so |
| | | 45 | | SourceStale |
| | | 46 | | } |