Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ChangeLog

# 2.0.12
- Fixed the catch id error.

# 2.0.10
- Upgrade the sse function generate function.

Expand Down
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ChangeLog

# 2.0.12
- Fixed the catch id error.

# 2.0.10
- Upgrade the sse function generate function.

Expand Down
4 changes: 2 additions & 2 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2209,11 +2209,11 @@ setup(
return;
}
if (!catchBlock.id.type) {
this.emit(`except Exception as ${_avoidKeywords(_name(ast.catchId))} :\n`, level);
this.emit(`except Exception as ${_avoidKeywords(_name(catchBlock.id))} :\n`, level);
} else {
this.emit('except ', level);
this.visitType(catchBlock.id.type);
this.emit(` as ${_avoidKeywords(_name(ast.catchId))} :\n`);
this.emit(` as ${_avoidKeywords(_name(catchBlock.id))} :\n`);
}
this.visitStmts(catchBlock.catchStmts, level + 2);
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@darabonba/python-generator",
"version": "2.0.11",
"version": "2.0.12",
"description": "The darabonba generator for Python",
"main": "lib/generator.js",
"directories": {
Expand Down
24 changes: 12 additions & 12 deletions tests/expected/complex/tea_python_tests/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,12 +1115,12 @@ def multi_try_catch(
code = 'str'
)

except main_exceptions.Err1Exception as err :
logging.log(logging.NOTSET, err.name)
except main_exceptions.Err2Exception as err :
logging.log(logging.NOTSET, err.name)
except source_exceptions.Err3Exception as err :
logging.log(logging.NOTSET, err.name)
except main_exceptions.Err1Exception as err1 :
logging.log(logging.NOTSET, err_1.name)
except main_exceptions.Err2Exception as err2 :
logging.log(logging.NOTSET, err_2.name)
except source_exceptions.Err3Exception as err3 :
logging.log(logging.NOTSET, err_3.name)
except Exception as err :
logging.log(logging.NOTSET, err.name)
finally:
Expand Down Expand Up @@ -1157,12 +1157,12 @@ async def multi_try_catch_async(
code = 'str'
)

except main_exceptions.Err1Exception as err :
logging.log(logging.NOTSET, err.name)
except main_exceptions.Err2Exception as err :
logging.log(logging.NOTSET, err.name)
except source_exceptions.Err3Exception as err :
logging.log(logging.NOTSET, err.name)
except main_exceptions.Err1Exception as err1 :
logging.log(logging.NOTSET, err_1.name)
except main_exceptions.Err2Exception as err2 :
logging.log(logging.NOTSET, err_2.name)
except source_exceptions.Err3Exception as err3 :
logging.log(logging.NOTSET, err_3.name)
except Exception as err :
logging.log(logging.NOTSET, err.name)
finally:
Expand Down
12 changes: 6 additions & 6 deletions tests/fixtures/complex/main.dara
Original file line number Diff line number Diff line change
Expand Up @@ -608,12 +608,12 @@ async function multiTryCatch(a: number): void {
code = "str",
}
}
} catch(err: Err1) {
$Logger.log(err.name);
} catch(err: Err2) {
$Logger.log(err.name);
} catch(err: Source.Err3) {
$Logger.log(err.name);
} catch(err1: Err1) {
$Logger.log(err1.name);
} catch(err2: Err2) {
$Logger.log(err2.name);
} catch(err3: Source.Err3) {
$Logger.log(err3.name);
} catch(err) {
$Logger.log(err.name);
} finally {
Expand Down