kopia lustrzana https://github.com/OpenDroneMap/WebODM
Better error handling, tweaks
rodzic
ae0a0cbf67
commit
db81a67c53
|
@ -268,7 +268,7 @@ class Map extends React.Component {
|
|||
|
||||
handleMapMouseDown(e){
|
||||
// Make sure the share popup closes
|
||||
this.shareButton.hidePopup();
|
||||
if (this.sharePopup) this.shareButton.hidePopup();
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -6,7 +6,7 @@ import PluginsAPI from './classes/plugins/API';
|
|||
|
||||
// Main is always executed first in the page
|
||||
|
||||
// We share some objects to avoid having to include it
|
||||
// We share some objects to avoid having to include them
|
||||
// as a dependency in each component (adds too much space overhead)
|
||||
window.ReactDOM = ReactDOM;
|
||||
window.React = React;
|
||||
|
|
|
@ -40,12 +40,13 @@ class TaskVolume(TaskNestedView):
|
|||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"calc_volume.grass"
|
||||
), context.serialize()).get()
|
||||
if isinstance(output, dict) and 'error' in output: raise GrassEngineException(output['error'])
|
||||
|
||||
cols = output.split(':')
|
||||
if len(cols) == 7:
|
||||
return Response({'volume': str(abs(float(cols[6])))}, status=status.HTTP_200_OK)
|
||||
else:
|
||||
raise GrassEngineException("Invalid GRASS output: {}".format(output))
|
||||
raise GrassEngineException(output)
|
||||
except GrassEngineException as e:
|
||||
return Response({'error': str(e)}, status=status.HTTP_200_OK)
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ module.exports = class MeasurePopup extends React.Component {
|
|||
lastCoord.dd.x
|
||||
));
|
||||
|
||||
console.log(layers);
|
||||
|
||||
// Did we select a layer?
|
||||
if (layers.length > 0){
|
||||
const layer = layers[layers.length - 1];
|
||||
|
@ -95,7 +97,7 @@ module.exports = class MeasurePopup extends React.Component {
|
|||
<p>Perimeter: {this.props.model.lengthDisplay}</p>
|
||||
{volume === null && !error && <p>Volume: <i>computing...</i> <i className="fa fa-cog fa-spin fa-fw" /></p>}
|
||||
{typeof volume === "number" && <p>Volume: {volume.toFixed("2")} Cubic Meters ({(volume * 35.3147).toFixed(2)} Cubic Feet)</p>}
|
||||
{error && <p>Volume: <span className="error theme-background-failed">{error}</span></p>}
|
||||
{error && <p>Volume: <span className={"error theme-background-failed " + (error.length > 200 ? 'long' : '')}>{error}</span></p>}
|
||||
</div>);
|
||||
}
|
||||
}
|
|
@ -2,4 +2,10 @@
|
|||
p{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.error.long{
|
||||
overflow: scroll;
|
||||
display: block;
|
||||
max-height: 200px;
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ from django.db.models import Q
|
|||
|
||||
from app.models import Project
|
||||
from app.models import Task
|
||||
from app.plugins.grass_engine import grass
|
||||
from app.plugins.grass_engine import grass, GrassEngineException
|
||||
from nodeodm import status_codes
|
||||
from nodeodm.models import ProcessingNode
|
||||
from webodm import settings
|
||||
|
@ -82,5 +82,8 @@ def process_pending_tasks():
|
|||
|
||||
@app.task
|
||||
def execute_grass_script(script, serialized_context = {}):
|
||||
ctx = grass.create_context(serialized_context)
|
||||
return ctx.execute(script)
|
||||
try:
|
||||
ctx = grass.create_context(serialized_context)
|
||||
return ctx.execute(script)
|
||||
except GrassEngineException as e:
|
||||
return {'error': str(e)}
|
Ładowanie…
Reference in New Issue