Fix error msg invalid stack or res name

If template contains resource with name like
'res/name', we will get traceback instead of
correct error message. The same situation with
stack name: if it's incorrect, we will get
traceback.

Change-Id: I4a0e51ff649aaaad5f18f52383dab186dab54230
Closes-bug: #1397313
Merge "Fix error msg invalid stack or res name"