here I want to capture the error details in trace , log , that I can see in production web page

If you want to quit processiong, it's enough to either quit:

 quit:$$$ISERR(sc) sc

Or raise an error (if you're several levels deep for example):

$$$TOE(sc, sc)

If you don't want to interrupt processing, use $$$LOG macroes, for example:

$$$LOGWARNING($System.Status.GetErrorText(sc))

This code would create a new Log entry of a warning type.

Project the list of geo.model.Point as a separate table:

Class geo.model.Line Extends %Persistent
{
Property points As list Of geo.model.Point(SQLPROJECTION = "table/column");
}

And you can use SQL query (via iris.sql) to get all points in line:

SELECT
    points_latitude, 
    points_longitude
FROM geo_model.Line_points
WHERE Line = ?
ORDER BY element_key

If you have thousands of points that would likely be the fastest way to transfer (barring callin/callout shenanigans).

I guess you need to flush the buffer so only python writes? Something like this should work:

Class Python.App.Dispatch Extends %CSP.REST
{

XData UrlMap [ XMLNamespace = "https://www.intersystems.com/urlmap" ]
{
<Routes>
    <Route Url="/test" Method="GET" Call="Wrapper" />
</Routes>
}

ClassMethod Wrapper()
{
	write *-3
	do ..Hello()
	q $$$OK
}

ClassMethod Hello() [ Language = python ]
{
    import iris

    print('Hello World')
}

}

Calling @Bob Kuszewski