Skip to content

Commit

Permalink
deploy: 2848c68
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] committed Jan 13, 2025
1 parent 7e62221 commit 3113c34
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 3 deletions.
93 changes: 92 additions & 1 deletion error.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ <h1 class="title">Module <code>geoengine.error</code></h1>

from typing import Any, Dict, Union
import json
import xml.etree.ElementTree as ET
from requests import Response, HTTPError
import geoengine_openapi_client

Expand Down Expand Up @@ -234,7 +235,33 @@ <h1 class="title">Module <code>geoengine.error</code></h1>
self.__message = message

def __str__(self) -&gt; str:
return f&#34;Method is only available in Geo Engine Pro: {self.__message}&#34;</code></pre>
return f&#34;Method is only available in Geo Engine Pro: {self.__message}&#34;


class OGCXMLError(Exception):
&#39;&#39;&#39;
Exception when an OGC XML error is returned
&#39;&#39;&#39;

__xml: ET.Element

def __init__(self, xml: bytearray) -&gt; None:
super().__init__()

self.__xml = ET.fromstring(xml[1:])

def __str__(self) -&gt; str:
service_exception = &#39;&#39;
for e in self.__xml:
if &#39;ServiceException&#39; in e.tag and e.text is not None:
service_exception = e.text
break

return f&#39;OGC API error: {service_exception}&#39;

@classmethod
def is_ogc_error(cls, xml: bytearray) -&gt; bool:
return xml.startswith(b&#34;\n&lt;?xml&#34;)</code></pre>
</details>
</section>
<section>
Expand Down Expand Up @@ -571,6 +598,64 @@ <h3>Ancestors</h3>
<li>builtins.BaseException</li>
</ul>
</dd>
<dt id="geoengine.error.OGCXMLError"><code class="flex name class">
<span>class <span class="ident">OGCXMLError</span></span>
<span>(</span><span>xml: bytearray)</span>
</code></dt>
<dd>
<div class="desc"><p>Exception when an OGC XML error is returned</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class OGCXMLError(Exception):
&#39;&#39;&#39;
Exception when an OGC XML error is returned
&#39;&#39;&#39;

__xml: ET.Element

def __init__(self, xml: bytearray) -&gt; None:
super().__init__()

self.__xml = ET.fromstring(xml[1:])

def __str__(self) -&gt; str:
service_exception = &#39;&#39;
for e in self.__xml:
if &#39;ServiceException&#39; in e.tag and e.text is not None:
service_exception = e.text
break

return f&#39;OGC API error: {service_exception}&#39;

@classmethod
def is_ogc_error(cls, xml: bytearray) -&gt; bool:
return xml.startswith(b&#34;\n&lt;?xml&#34;)</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
<li>builtins.Exception</li>
<li>builtins.BaseException</li>
</ul>
<h3>Static methods</h3>
<dl>
<dt id="geoengine.error.OGCXMLError.is_ogc_error"><code class="name flex">
<span>def <span class="ident">is_ogc_error</span></span>(<span>xml: bytearray) ‑> bool</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">@classmethod
def is_ogc_error(cls, xml: bytearray) -&gt; bool:
return xml.startswith(b&#34;\n&lt;?xml&#34;)</code></pre>
</details>
</dd>
</dl>
</dd>
<dt id="geoengine.error.SpatialReferenceMismatchException"><code class="flex name class">
<span>class <span class="ident">SpatialReferenceMismatchException</span></span>
<span>(</span><span>spatial_reference_a: str, spatial_reference_b: str)</span>
Expand Down Expand Up @@ -713,6 +798,12 @@ <h4><code><a title="geoengine.error.MissingFieldInResponseException" href="#geoe
<h4><code><a title="geoengine.error.ModificationNotOnLayerDbException" href="#geoengine.error.ModificationNotOnLayerDbException">ModificationNotOnLayerDbException</a></code></h4>
</li>
<li>
<h4><code><a title="geoengine.error.OGCXMLError" href="#geoengine.error.OGCXMLError">OGCXMLError</a></code></h4>
<ul class="">
<li><code><a title="geoengine.error.OGCXMLError.is_ogc_error" href="#geoengine.error.OGCXMLError.is_ogc_error">is_ogc_error</a></code></li>
</ul>
</li>
<li>
<h4><code><a title="geoengine.error.SpatialReferenceMismatchException" href="#geoengine.error.SpatialReferenceMismatchException">SpatialReferenceMismatchException</a></code></h4>
</li>
<li>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h1 class="title">Package <code>geoengine</code></h1>
from .error import GeoEngineException, InputException, UninitializedException, TypeException, \
MethodNotCalledOnPlotException, MethodNotCalledOnRasterException, MethodNotCalledOnVectorException, \
SpatialReferenceMismatchException, check_response_for_error, ModificationNotOnLayerDbException, \
InvalidUrlException, MissingFieldInResponseException
InvalidUrlException, MissingFieldInResponseException, OGCXMLError
from .layers import Layer, LayerCollection, LayerListing, LayerCollectionListing, \
LayerId, LayerCollectionId, LayerProviderId, \
layer_collection, layer
Expand Down
11 changes: 10 additions & 1 deletion workflow.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h1 class="title">Module <code>geoengine.workflow</code></h1>
from geoengine import api
from geoengine.auth import get_session
from geoengine.error import GeoEngineException, InputException, MethodNotCalledOnPlotException, \
MethodNotCalledOnRasterException, MethodNotCalledOnVectorException
MethodNotCalledOnRasterException, MethodNotCalledOnVectorException, OGCXMLError
from geoengine import backports
from geoengine.types import ProvenanceEntry, QueryRectangle, RasterColorizer, ResultDescriptor, \
VectorResultDescriptor, ClassificationMeasurement
Expand Down Expand Up @@ -311,6 +311,9 @@ <h1 class="title">Module <code>geoengine.workflow</code></h1>
time=bbox.time_str
)

if OGCXMLError.is_ogc_error(response):
raise OGCXMLError(response)

return Image.open(BytesIO(response))

def plot_json(self, bbox: QueryRectangle, timeout: int = 3600) -&gt; geoengine_openapi_client.WrappedPlotOutput:
Expand Down Expand Up @@ -1741,6 +1744,9 @@ <h3>Class variables</h3>
time=bbox.time_str
)

if OGCXMLError.is_ogc_error(response):
raise OGCXMLError(response)

return Image.open(BytesIO(response))

def plot_json(self, bbox: QueryRectangle, timeout: int = 3600) -&gt; geoengine_openapi_client.WrappedPlotOutput:
Expand Down Expand Up @@ -3170,6 +3176,9 @@ <h2 id="parameters">Parameters</h2>
time=bbox.time_str
)

if OGCXMLError.is_ogc_error(response):
raise OGCXMLError(response)

return Image.open(BytesIO(response))</code></pre>
</details>
</dd>
Expand Down

0 comments on commit 3113c34

Please sign in to comment.